This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sir-sigurd
Recipients sir-sigurd, vstinner
Date 2019-09-19.15:27:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568906863.55.0.658893589316.issue38147@roundup.psfhosted.org>
In-reply-to
Content
> If you care of _PyLong_Copy() performance, you should somehow manually inline _PyLong_New() inside _PyLong_Copy().

It doesn't solve this:

> We could add a function that bypass that check, but in LTO build PyObject_MALLOC() is inlined into _PyLong_New() and it also checks the size. Adding Py_ASSUME((size_t)size <= MAX_LONG_DIGITS) allows to bypass both checks.

Here's example: https://github.com/sir-sigurd/cpython/commit/c8699d0c614a18d558216ae7d432107147c95c28.

I attach some disassembly from this example compiled with LTO, to demonstrate how the proposed macro affects generated code.
History
Date User Action Args
2019-09-19 15:27:43sir-sigurdsetrecipients: + sir-sigurd, vstinner
2019-09-19 15:27:43sir-sigurdsetmessageid: <1568906863.55.0.658893589316.issue38147@roundup.psfhosted.org>
2019-09-19 15:27:43sir-sigurdlinkissue38147 messages
2019-09-19 15:27:43sir-sigurdcreate