Yes, and I discovered an error in my testing of Line Input...
It turns out that Line Input will never read an LF-record file properly: I was erroneously using a short CRLF file when I was trying to verify that Line Input was worth anything at all here.
... but files that contain odd numbers of bytes would have to be adjusted for...
I allowed for ANSI files of any length already in the source I provided above. This isn't a factor at all.
The Jet Text method does seem to handle LF as well as CRLF. It still takes a long time on my machine... but it does work and is pretty concise in terms of source statements. I still get faster results than Line Input even with CRLF records - significantly so.
I think we've pretty much beaten the topic to death by now.
My tests with a 1.2M line file seem pretty conclusive.
Using the expensive "cheat" of recopying the input file to have CRLF line terminations I get:
Code:
Trial #1 Byte Array Chunk:
0.7617188 seconds 1200000 lines
String Chunk:
1.480469 seconds 1200000 lines
Line Input:
9.863281 seconds 1200000 lines
Jet Text:
26.39844 seconds 1200000 lines
Trial #2 Byte Array Chunk:
0.5703125 seconds 1200000 lines
String Chunk:
1.183594 seconds 1200000 lines
Line Input:
9.101563 seconds 1200000 lines
Jet Text:
25.80859 seconds 1200000 lines
Trial #3 Byte Array Chunk:
0.5585938 seconds 1200000 lines
String Chunk:
1.183594 seconds 1200000 lines
Line Input:
9.070313 seconds 1200000 lines
Jet Text:
25.71875 seconds 1200000 lines
Disk caching is clearly a factor. If you need to just determine the file's size in one pass there won't be a huge advantage in using Byte arrays over chunking into a String and just using an InStr() loop to count the LFs.
Reading a file with LF line terminations the results are substantially the same, except Line Input can't be used at all. Cutting the chunk or block size to 1000 bytes substantially degraded performance but still produced results about 10 times as good as Line Input.
I've already found two bone-headed errors of my own so I won't claim there aren't others. The variation in posted results differ wildly enough that I have to wonder what other dumb mistakes I must be making.
I don't think we're all testing the same things here.