Message352970
C type `long` is 4-byte integer in 64-bit Windows build. [1]
But `ucs1lib_find_max_char()` function [2] uses SIZEOF_LONG, so it loses a little performance in 64-bit Windows build.
Below is the benchmark of using SIZEOF_SIZE_T and this change:
- unsigned long value = *(unsigned long *) _p;
+ sizt_t value = *(sizt_t *) _p;
D:\dev\cpython\PCbuild\amd64\python.exe -m pyperf timeit -s "b=b'a'*10_000_000; f=b.decode;" "f('latin1')"
before: 5.83 ms +- 0.05 ms
after : 5.58 ms +- 0.06 ms
[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. |
|
Date |
User |
Action |
Args |
2019-09-22 11:50:02 | malin | set | recipients:
+ malin, methane, serhiy.storchaka, sir-sigurd |
2019-09-22 11:50:02 | malin | set | messageid: <1569153002.15.0.915285235862.issue38252@roundup.psfhosted.org> |
2019-09-22 11:50:02 | malin | link | issue38252 messages |
2019-09-22 11:50:01 | malin | create | |
|