[issue42304] [easy C] long type performance waste in 64-bit Windows build

Ma Lin report at bugs.python.org
Tue Nov 10 05:33:09 EST 2020


Ma Lin <malincns at 163.com> added the comment:

> I do not think that this is suitable for newcomers because you need to have deep understanding why it was written in such form at first place and what will be changed if you change it.

I agree contributors need to understand code, rather than simply replace the type. Maybe two weeks is enough to understand the code.

> And it could negatively affect performance, especially on 32-bit platforms.

`long` type can be replaced by `ssize_t`.
`unsigned long` type can be replaced by `size_t`.
And use `PyLong_FromSize_t`/`PyLong_FromSize_t`, then there is no negative impact.

> I don't think that it's worth it to optimize this one.

Although the speedup is small, it's free.
I don't see it as optimization, just no more waste.

> I suggest to fix in it bpo-38252.

I forgot it in that issue, I just searched "0x80808080" in the code, it was missed.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42304>
_______________________________________


More information about the Python-bugs-list mailing list