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 <rep...@bugs.python.org> <http://bugs.python.org/issue25401> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com