[New-bugs-announce] [issue25401] Optimize bytes.fromhex() and bytearray.fromhex()

STINNER Victor report at bugs.python.org
Wed Oct 14 11:09:20 CEST 2015


New submission from STINNER Victor:

Attached patch optimizes bytes.fromhex() and bytearray.fromhex():

* Fast-path working on a char* string for ASCII string
* Slow-path for non-ASCII string
* Replace slow hex_digit_to_int() function with a O(1) lookup in _PyLong_DigitValue precomputed table
* Use _PyBytesWriter API to handle the buffer
* Check the error position in error messages

----------
files: fromhex.patch
keywords: patch
messages: 252979
nosy: haypo
priority: normal
severity: normal
status: open
title: Optimize bytes.fromhex() and bytearray.fromhex()
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file40779/fromhex.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25401>
_______________________________________


More information about the New-bugs-announce mailing list