Message259554
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 |
|
Date |
User |
Action |
Args |
2016-02-04 10:30:04 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, lemburg, rhettinger, mark.dickinson, pitrou, vstinner, casevh, yselivanov, josh.r, zbyrne |
2016-02-04 10:30:04 | serhiy.storchaka | set | messageid: <1454581804.1.0.394728929768.issue21955@psf.upfronthosting.co.za> |
2016-02-04 10:30:04 | serhiy.storchaka | link | issue21955 messages |
2016-02-04 10:30:03 | serhiy.storchaka | create | |
|