Author vstinner
Recipients vstinner
Date 2014-05-02.21:54:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1399067662.75.0.0621982207381.issue21420@psf.upfronthosting.co.za>
In-reply-to
Content
The algorithm for 2 ** n (long_pow) is slower than 1 << n algorithm (long_lshift). I propose to compute x**y as 1<<y if x==2 and y >= 0.

Attached patch implements this idea. According to my microbenchmark, it is 4x faster to small power (2**0 .. 2**1024) and up to 340x faster for large power (2**(2**28)).
History
Date User Action Args
2014-05-02 21:54:22vstinnersetrecipients: + vstinner
2014-05-02 21:54:22vstinnersetmessageid: <1399067662.75.0.0621982207381.issue21420@psf.upfronthosting.co.za>
2014-05-02 21:54:22vstinnerlinkissue21420 messages
2014-05-02 21:54:22vstinnercreate