Re:The scope of index variables in Python's for loops
by acadien on Sunday January 18, 2015 @03:43PM
(#8908797)
I've done timing tests and it is typically on par with tail & wc. The bulk of the time is wasted reading your file into ram, the time it takes to count the lines is essentially 0.
Edit: Of course I misspoke, yes tail is much faster for getting the last line of the file! I meant for getting the line count the loop methods is typically just ~5% slower than wc on sufficiently large files.
Edit: Of course I misspoke, yes tail is much faster for getting the last line of the file! I meant for getting the line count the loop methods is typically just ~5% slower than wc on sufficiently large files.