3 ms·
I like numba, but I found that I often had to rewrite my code (like write out vectorized numpy code). Recently I have mainly been using pythran which IMO is ver
by cycomanic 5y ago
I like numba, but I found that I often had to rewrite my code (like write out vectorized numpy code). Recently I have mainly been using pythran which IMO is very underrated. It manages to even beat optimized cython code with just a comment in front of the function definition.
I did a comparison to cython and Julia here: https://jochenschroeder.com/blog/articles/DSP_with_Python2/ https://jochenschroeder.com/blog/articles/DSP_with_Python2/
- rerx 5y agoPythran sounds awesome. I've somehow always glossed over it before. That might be due to the name, which made me think it was some Fortran-interop library (and those tend to be old and not what I need)...
- cycomanic 5y agoIf you write quite a bit of numerical code you can often achieve impressive speed ups using pythran with very little changes, it's like numexpr + cython on steroids. I highly recommend checking it out. The community is quite small, so there are still some bugs, Serge the main author is really responsive.
- tomthe 5y agoThat is a really good comparison, thank you for this article! I have somehow never heard about pythran before. Interesting to see the comparison to Julia as well. Did you have a look at JAX? It would be interesting to see how well it would compare.
- xiaodai 5y agoHmm, suspect the julia code in that post is not optimized Perhaps try asking on https://discourse.julialang.org/ https://discourse.julialang.org/
- cycomanic 5y agoI would not be surprised. I did post it to HN at the time, and received some feedback on how I should better optimise (which I mention at the bottom of the post). The exercise for me was to see how I fast I could get the julia code with my background, I am quite honest about the fact that I have less experience in julia, however for me the whole reason to look for something else then cython is that it takes so much background knowledge to get the ultimate speed, if I have to do the same for julia I don't really gain anything. I would argue the amount of optimisations in the julia code are already more than what I had to do in pythran.