[issue24076] sum() several times slower on Python 3

Stefan Behnel report at bugs.python.org
Fri May 1 08:09:58 CEST 2015


Stefan Behnel added the comment:

I don't think it's irrelevant. Throw-away integers are really not uncommon. For-loops use them quite often, non-trivial arithmetic expressions can create a lot of intermediate temporaries. Speeding up the create-delete cycle of PyLong sounds like a very obvious thing to do.

Imagine some code that iterates over a list of integers, applies some calculation to them, and then stores them in a new list, maybe even using a list comprehension or so. If you could speed up the intermediate calculation by avoiding overhead in creating temporary PyLong objects, such code could benefit a lot.

I suspect that adding a free-list for single-digit PyLong objects (the most common case) would provide some visible benefit.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24076>
_______________________________________


More information about the Python-bugs-list mailing list