Consider this python program:
import sys lc = 0 for line in open(sys.argv[1]): lc = lc + 1 print lc, sys.argv[1]
Running it on my 6GB
Note that Python I/O is implemented in C, so there is not much luck speeding it up further.