[issue45155] Add default arguments for int.to_bytes()

Raymond Hettinger report at bugs.python.org
Sun Sep 12 07:20:58 EDT 2021


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Interestingly, "little" is faster than "big".

$ python3.10 -m timeit -r11 -s 'x=3452452454524' 'x.to_bytes(10, "little")'
5000000 loops, best of 11: 82.7 nsec per loop
$ python3.10 -m timeit -r11 -s 'x=3452452454524' 'x.to_bytes(10, "big")'
5000000 loops, best of 11: 90.6 nsec per loop

----------

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


More information about the Python-bugs-list mailing list