Hmm. this didn't render the newlines in my code, and markdown doesn't seem to be supported. bummer.
Really cool! It seems to be comparable and perhaps even faster than cython!
I happened to be in an Ipython shell and didn't see anyway to do this with nim, but you can probably get a good approximate of the speedup with nim in Ipython/Jupyter by doing a quick:
[1] %load_ext Cython
[2] %%cython
```
cpdef long cyfib(int n):
if n <= 2:
return 1
else:
return cyfib(n - 1) + cyfib(n - 2)
```
[3] start=time.time(); x = cyfib(47); end=time.time(); print(x); print(end-start)
2971215073
5.558561325073242
Nice choice of 47! I had to change the cython function's return time to long to prevent overflow. Something you don't need to do in nim
Really cool! It seems to be comparable and perhaps even faster than cython!
I happened to be in an Ipython shell and didn't see anyway to do this with nim, but you can probably get a good approximate of the speedup with nim in Ipython/Jupyter by doing a quick:
[1] %load_ext Cython
[2] %%cython ``` cpdef long cyfib(int n): if n <= 2: return 1 else: return cyfib(n - 1) + cyfib(n - 2) ```
[3] start=time.time(); x = cyfib(47); end=time.time(); print(x); print(end-start)
2971215073 5.558561325073242
Nice choice of 47! I had to change the cython function's return time to long to prevent overflow. Something you don't need to do in nim