commit | 2bf8993db966256d564d87865ceddf0e33c02500 | [log] [tgz] |
---|---|---|
author | Victor Stinner <victor.stinner@gmail.com> | Wed Oct 14 11:25:33 2015 +0200 |
committer | Victor Stinner <victor.stinner@gmail.com> | Wed Oct 14 11:25:33 2015 +0200 |
tree | 8b172dcec9ee6d9584c75ecc933b418b5210963b | |
parent | ebcf9edc05c03af38c01d8aeb05494b68169756c [diff] |
Optimize bytes.fromhex() and bytearray.fromhex() Issue #25401: Optimize bytes.fromhex() and bytearray.fromhex(): they are now between 2x and 3.5x faster. Changes: * Use a fast-path working on a char* string for ASCII string * Use a 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 * Add unit tests to check the error position in error messages