Timeline for Determine the Number of Lines in a Text File
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 19, 2013 at 3:19 | comment | added | wxffles | As written, the code is reading char by char. Who knows if the underlying implementation is reading in more efficient chunks? I agree that C++ I/O is a bit disappointing (and not the easiest to use either!). I might go buy a solid state drive to compensate. | |
Apr 19, 2013 at 1:07 | comment | added | Szabolcs |
It should also depend heavily on implementation. I tried it on a Mac now (timings: 0.21 this one vs 0.07 wc ), but I remember that when I experimented on WinXP, code similar to your compiled with MinGW gcc ran considerably faster than when compiled with MSVC.
|
|
Apr 19, 2013 at 1:02 | comment | added | Szabolcs |
Funnily, using the wc utility is still much faster than this on my system (even if I use sync_with_stdio(false) ). Somehow I've never been satisfied with the performance naive C++ I/O code gives me, nor patient enough to get to the bottom of why it performs so bad.
|
|
Apr 18, 2013 at 22:06 | history | answered | wxffles | CC BY-SA 3.0 |