I tried unxutils\' wc -l but it crashed for 1GB files. I tried this C# code
long count = 0;
using (StreamReader r = new StreamReader(f))
{
st
Your first approach does look like the optimal solution already. Keep in mind that you're mostly not CPU bound but limited by the HD's read speed, which at 500MB / 4sec = 125MB/s is already quite fast. The only way to get faster than that is via RAID or using SSDs, not so much via a better algorithm.