ENH rewrite best-first decoder in Cython