Code:
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls s/call s/call name
84.40 3.30 3.30 1 3.30 3.30 GetFileLineAmount
12.79 3.80 0.50 1 0.50 0.50 waltp
2.81 3.91 0.11 1 0.11 0.11 whoie
This is why I was suggesting not using fgets, because it requires two passes over the data, and the [f]scanf version only uses one so it should be about twice as fast as fgets. Although, the disk I/O totally dominates the overall timing (as expected), so that's really just interesting from a scientific point of view.