This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients casevh, josh.r, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, vstinner, yselivanov, zbyrne
Date 2016-02-03.17:00:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454518824.58.0.481862737212.issue21955@psf.upfronthosting.co.za>
In-reply-to
Content
Attaching a new patch -- rewritten to optimize -, *, +, -=, *= and +=.  I also removed the optimization of [] operator -- that should be done in a separate patch and in a separate issue.

Some nano-benchmarks (best of 3):

python -m timeit  "sum([x + x + 1 for x in range(100)])"
2.7: 7.71     3.5: 8.54      3.6: 7.33

python -m timeit  "sum([x - x - 1 for x in range(100)])"
2.7: 7.81     3.5: 8.59      3.6: 7.57

python -m timeit  "sum([x * x * 1 for x in range(100)])"
2.7: 9.28     3.5: 10.6      3.6: 9.44


Python 3.6 vs 3.5 (spectral_norm, rigorous run):
Min: 0.315917 -> 0.276785: 1.14x faster
Avg: 0.321006 -> 0.284909: 1.13x faster


Zach, thanks a lot for the research!  I'm glad that unpack_sequence finally proved to be irrelevant.  Could you please take a look at the updated patch?
History
Date User Action Args
2016-02-03 17:00:24yselivanovsetrecipients: + yselivanov, rhettinger, mark.dickinson, pitrou, vstinner, casevh, serhiy.storchaka, josh.r, zbyrne
2016-02-03 17:00:24yselivanovsetmessageid: <1454518824.58.0.481862737212.issue21955@psf.upfronthosting.co.za>
2016-02-03 17:00:24yselivanovlinkissue21955 messages
2016-02-03 17:00:24yselivanovcreate