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
History
Date User Action Args
2016-02-04 10:30:04serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, rhettinger, mark.dickinson, pitrou, vstinner, casevh, yselivanov, josh.r, zbyrne
2016-02-04 10:30:04serhiy.storchakasetmessageid: <1454581804.1.0.394728929768.issue21955@psf.upfronthosting.co.za>
2016-02-04 10:30:04serhiy.storchakalinkissue21955 messages
2016-02-04 10:30:03serhiy.storchakacreate