Subject:
|
Re: how does a line ends?
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Mon, 9 Apr 2007 22:00:49 GMT
|
Viewed:
|
2201 times
|
| |
| |
In lugnet.cad, Travis Cobbs wrote:
|
In lugnet.cad, Ross Crawford wrote:
Thanks, ROSCO. I took that code and modified it to use char instead of
_TCHAR, and got timings of 720-750ms, compared to the 750-780ms I got with
my original one. I then modified it to support CR and LF interchangeably,
and got back to the 750-780ms timings from my original code. So it seems
safe to say that the actual MS fgets function is done differently. (The one
you posted is for _TCHAR, which is two bytes when UNICODE is defined, and
one byte when UNICODE isnt defined.)
|
Now that Im at work, Im able to look at Microsofts implementation of fgets
for Visual Studio 2005. They do a lock on the file prior to their loop, then
call _fgetc_nolock to get each character, instead of fgetc or fread. (Thats
an MS-specific function, obviously.) This means that theres no locking
overhead involved in each character read, and Im guessing thats what provides
the performance boost. Normally each call to fgetc or fread would require a
lock/unlock.
--Travis
|
|
Message is in Reply To:
| | Re: how does a line ends?
|
| (...) Thanks, ROSCO. I took that code and modified it to use char instead of _TCHAR, and got timings of 720-750ms, compared to the 750-780ms I got with my original one. I then modified it to support CR and LF interchangeably, and got back to the (...) (18 years ago, 7-Apr-07, to lugnet.cad, FTX)
|
24 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|