[issue26167] Improve copy.copy speed for built-in types (list/set/dict)

Serhiy Storchaka report at bugs.python.org
Sun Mar 6 05:46:35 EST 2016


Serhiy Storchaka added the comment:

> This looks nicer and should run faster by taking advantage of the LIST_APPEND opcode.

The difference is insignificantly (less than 1%) for large lists (list(range(10000))), but it is 3-4% slower for small lists (list(range(10))) and 20-25% slower for empty lists.

On 2.7 your code always has advantage, but on 3.x seems it doesn't have any advantage (thanks to overhead of using a generator).

----------

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


More information about the Python-bugs-list mailing list