Uh oh!
There was an error while loading. Please reload this page.
gh-149079: Optimize sorting in unicodedata.normalize() - #150782
Conversation
Sort the Py_UCS4 buffer instead of PyUnicodeObject. This allows to avoid the use of PyUnicode_READ() and PyUnicode_WRITE().
Baseline: 100 loops, best of 5: 3.76 msec per loop Baseline: 100 loops, best of 5: 3.99 msec per loop |
eendebakpt
commented
Jun 2, 2026
@serhiy-storchaka On your benchmark I can improve from 3.75 ms to 2.0 ms by using a more efficient search in |
serhiy-storchaka
commented
Jun 2, 2026
Looks interesting. But this is a different issue, not directly related to #149079. Can you open a new issue? |
eendebakpt
commented
Jun 3, 2026
eendebakpt
left a comment
There was a problem hiding this comment.
I benchmarked the PR (rebased onto main first) and found a 10% to 20% speedup on the benchmarks.
Uh oh!
There was an error while loading. Please reload this page.
encukou
commented
Jun 15, 2026
Thank you! |
…H-150782) Sort the Py_UCS4 buffer instead of PyUnicodeObject. This allows to avoid the use of PyUnicode_READ() and PyUnicode_WRITE().
Sort the Py_UCS4 buffer instead of PyUnicodeObject. This allows to avoid the use of PyUnicode_READ() and PyUnicode_WRITE().
unicodedata.normalize("NFC")canonical ordering #149079