Created
February 10, 2022 19:35
-
-
Save sergiolucero/ad8ee5a3b0f7078170dab76dbac2d145 to your computer and use it in GitHub Desktop.
numba psums
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numba import jit | |
@jit(nopython=True) | |
def psum(p): | |
acc = 0 | |
for i in range(1,1000000): | |
acc += pow(i, -p) | |
return acc | |
import time | |
t0=time.time() | |
ps = [psum(p) for p in range(2,20)] | |
print('DT:', round(time.time()-t0,2)) |
even faster 2nd time around!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DT=0.7 vs 4.5 on data.quant.cl