implement cython accumulate stats