-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use 8-byte step to detect ASCII sequence in 64bit Windows builds #82433
Comments
C type But Below is the benchmark of using SIZEOF_SIZE_T and this change:
D:\dev\cpython\PCbuild\amd64\python.exe -m pyperf timeit -s "b=b'a'*10_000_000; f=b.decode;" "f('latin1')"
[1] https://stackoverflow.com/questions/384502 [2] https://github.com/python/cpython/blob/v3.8.0b4/Objects/stringlib/find_max_char.h#L9 Maybe there can be more optimizations, so I didn't prepare a PR for this. |
This looks like a good idea. Do you mind to create a PR? |
Maybe @sir-sigurd can find more optimizations. FYI, |
There are 4 functions have the similar code, see PR 16334.
D:\dev\cpython\PCbuild\amd64\python.exe -m pyperf timeit -s "b = b'x' * 100_000_000; f = b.isascii;" "f()" +-----------+-----------+------------------------------+
D:\dev\cpython\PCbuild\amd64\python.exe -m pyperf timeit -s "b = b'x' * 100_000_000; f = b.decode;" "f('latin1')" +-----------+----------+-----------------------------+
D:\dev\cpython\PCbuild\amd64\python.exe -m pyperf timeit -s "b = b'x' * 100_000_000; f = b.decode;" "f('ascii')" +-----------+---------+-----------------------------+
D:\dev\cpython\PCbuild\amd64\python.exe -m pyperf timeit -s "b = b'x' * 100_000_000; f = b.decode;" "f('utf8')" +-----------+---------+-----------------------------+ |
Although the improvement is not great, it's a very hot code path. Could you review the PR? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: