Improve the imperative version to use bytestring and now its as fast as the OCaml one