You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-m timeit -s "loops=tuple(range(1000))" "for x in loops: x+x"
with patch: 34.5 usec without patch: 45.9 usec
== Why only single-digit? ==
I've also a patch that implements free-lists for 1-digit, 2-digits and 3-digits longs, and collects statistics on them. It looks like we only want to optimize 1-digit longs:
2to3 benchmark (the first number is the number of all N-digit longs, the second number is the number of longs created via free-list):
Activity
1st1 commentedon Feb 11, 2016
The attached patch implements a free-list for single-digit longs. We already have free lists for many fundamental types, such as floats & unicode.
The patch improves performance in micro-benchmarks by 10-20%. It'll also lessen memory fragmentation issues.
== Benchmarks ==
### spectral_norm ###
Min: 0.268018 -> 0.245042: 1.09x faster
Avg: 0.289548 -> 0.257861: 1.12x faster
Significant (t=18.82)
Stddev: 0.01004 -> 0.00640: 1.5680x smaller
-m timeit -s "loops=tuple(range(1000))" "for x in loops: x+x"
with patch: 34.5 usec without patch: 45.9 usec
== Why only single-digit? ==
I've also a patch that implements free-lists for 1-digit, 2-digits and 3-digits longs, and collects statistics on them. It looks like we only want to optimize 1-digit longs:
===> d1_longs = 142384 124759
===> d2_longs = 6872 6264
===> d3_longs = 2907 2834
richards:
===> d1_longs = 219630 219033
===> d2_longs = 1455 1096
===> d3_longs = 630 627
spectral_norm:
===> d1_longs = 133928432 133927838
===> d2_longs = 1471 1113
===> d3_longs = 630 627
serhiy-storchaka commentedon Feb 11, 2016
This looks as a duplicate of bpo-24165.
1st1 commentedon Feb 11, 2016
You're right Serhiy, closing this one.