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

Serhiy Storchaka report at bugs.python.org
Mon Feb 8 08:47:18 EST 2016


Serhiy Storchaka added the comment:

Here are results of microbenchmarks (time in microseconds).

                                copy             deepcopy
                         unpatched patched unpatched   patched

()                           0.993    1.02      5.25      5.38
[]                            1.53    1.12      4.81      5.08
set()                         1.47    1.21      24.6      18.3
frozenset()                  0.991       1      23.4      16.7
{}                            1.59    1.19      5.24      5.45
bytearray()                   8.76    1.11      17.5      11.2
slice(1,10,2)                 7.94       1        23      18.7
NotImplemented                4.75       1      5.82      2.09

tuple(range(10))             0.975    1.01      26.1      26.6
list(range(10))               1.92    1.33      25.7      25.8
set(range(10))                2.17    1.94      47.6      40.6
frozenset(range(10))         0.973       1      47.3      40.3
dict.fromkeys(range(10))      2.19    1.87      43.1      44.8
bytearray(range(10))          10.5    1.17      21.8      17.4

tuple(range(1000))           0.967    1.01  1.97e+03  2.07e+03
list(range(1000))             5.74    5.53  2.02e+03  1.98e+03
set(range(1000))              20.5    20.9  2.15e+03  2.06e+03
frozenset(range(1000))       0.973   0.995  2.14e+03  2.06e+03
dict.fromkeys(range(1000))    49.6    49.3   3.8e+03  3.92e+03
bytearray(range(10))*100      11.5    1.47      23.5      18.9

----------

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


More information about the Python-bugs-list mailing list