Author malin
Recipients malin, methane, serhiy.storchaka, sir-sigurd
Date 2019-09-22.11:50:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569153002.15.0.915285235862.issue38252@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-09-22 11:50:02malinsetrecipients: + malin, methane, serhiy.storchaka, sir-sigurd
2019-09-22 11:50:02malinsetmessageid: <1569153002.15.0.915285235862.issue38252@roundup.psfhosted.org>
2019-09-22 11:50:02malinlinkissue38252 messages
2019-09-22 11:50:01malincreate