Message259554
| Author |
serhiy.storchaka |
| Recipients |
casevh, josh.r, lemburg, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, vstinner, yselivanov, zbyrne |
| Date |
2016年02月04日.10:30:02 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1454581804.1.0.394728929768.issue21955@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
fastint2.patch adds small regression for string multiplication:
$ ./python -m timeit -s "x = 'x'" -- "x*2; x*2; x*2; x*2; x*2; x*2; x*2; x*2; x*2; x*2; "
Unpatched: 1.46 usec per loop
Patched: 1.54 usec per loop
Here is an alternative patch. It just uses existing specialized functions for integers: long_add, long_sub and long_mul. It doesn't add regression for above example with string multiplication, and it looks faster than fastint2.patch for integer multiplication.
$ ./python -m timeit -s "x = 12345" -- "x*2; x*2; x*2; x*2; x*2; x*2; x*2; x*2; x*2; x*2; "
Unpatched: 0.887 usec per loop
fastint2.patch: 0.841 usec per loop
fastint_alt.patch: 0.804 usec per loop |
|