cython version of threestats