speed up stats gathering

instead of DB and rubbish data structures
use 2d dynamic array