A situation has come up where I need to know the number of lines in a large log file (50MB, 750K lines, could be much larger). I'm currently doing something like:
For no particular reason did I use a for loop rather than a while loop, guess I just like them better... Is there a more efficient way of doing this? I've dug through the api doc's, have I maybe missed something that would make this speedier? A 50MB 750K-line file is consistently taking about 3 seconds to return with sdk 1.5.0_05 XP Pro, on a 3GHz P4, 1GB RAM Desktop. The speed wouldn't bother me too much, but I use several unix-like command line tools: running "wc -l" (just counts the number of lines) against the file takes less than half a second (eye-ball estimate on that).
I'd appreciate any suggestions, thanks for taking the time to read this!
Bobby Joe Smith
Joined: Feb 27, 2006
Dang it, intended to post this in the "I/O and Streams" forum, my apologies for mis-posting it.