[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

STINNER Victor report at bugs.python.org
Mon Apr 20 20:32:21 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

Thanks Dennis for the optimization!

FYI I also pushed another optimization recently:

commit 455df9779873b8335b20292b8d0c43d66338a4db
Author: Victor Stinner <vstinner at python.org>
Date:   Wed Apr 15 14:05:24 2020 +0200

    Optimize _Py_strhex_impl() (GH-19535)
    
    Avoid a temporary buffer to create a bytes string: use
    PyBytes_FromStringAndSize() to directly allocate a bytes object.

----------
nosy: +vstinner
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40313>
_______________________________________


More information about the Python-bugs-list mailing list