Message217800
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)). |
|
Date |
User |
Action |
Args |
2014-05-02 21:54:22 | vstinner | set | recipients:
+ vstinner |
2014-05-02 21:54:22 | vstinner | set | messageid: <1399067662.75.0.0621982207381.issue21420@psf.upfronthosting.co.za> |
2014-05-02 21:54:22 | vstinner | link | issue21420 messages |
2014-05-02 21:54:22 | vstinner | create | |
|