Subject:
|
Re: how does a line ends?
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Sat, 7 Apr 2007 22:38:37 GMT
|
Viewed:
|
1732 times
|
| |
| |
In lugnet.cad, Travis Cobbs wrote:
|
It seems to work, but Im not 100% confident in its lack of bugs. Timing
with 8464.mpd results in about 550ms for loading using fgets and 750ms using
myFgets from above. On the one hand, thats a 50% slowdown based purely on
that one change. On the other hand, 750ms isnt very long, and while
8464.mpd isnt exactly a huge file, its big enough to prove your point that
the performance is fine.
|
Just as a proof of the value of disk caching, loading the same model using the
system fgets after a fresh reboot, the same loading portion took 3300ms.
Also, I switched the feof calls out for a check of the value against EOF just to
see if it made a difference, and it didnt. Within the accuracy of my
measurements, I got the same timing.
--Travis
|
|
Message is in Reply To:
| | Re: how does a line ends?
|
| (...) OK, as promised, here it my fgets replacement: char *myFgets(char *buf, int bufSize, FILE *file) int i; for (i = 0; i < bufSize - 1; i++) int char1 = fgetc(file); if (feof(file)) bufi = 0; if (i > 0) return buf; else return NULL; if (char1 == (...) (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
|
|
|
|