Incremental computation of stats

Do this by chunks instead of storing all the entries in memory