4 ms·
If your Python programs heavily use Pandas and Numpy, could there still be speed benefits to translating them to Nim?
by Bostonian 3y ago
If your Python programs heavily use Pandas and Numpy, could there still be speed benefits to translating them to Nim?
- janAkali 3y agoYour programs could benefit from small dependency-free executables and compile time code generation and execution. Nim code can also be called directly from python or vice versa, check out nimpy[1]. 1. https://github.com/yglukhov/nimpy https://github.com/yglukhov/nimpy
- maleldil 3y agoThat might depend on how many raw Python loops and functions you use. Even if most of your code uses pandas and numpy, things like string processing could still benefit from a compiled language.
- pointystick 3y agoHere's a presentation from last year where a Python data scientist compares a Python and Nim implementation for a problem, with the Python version calling out to Numpy. There are performance comparisons at the end and his Nim version was faster so Nim should be usable for scientific programming: https://archive.fosdem.org/2022/schedule/event/nim_hpcfrompythontonim/ https://archive.fosdem.org/2022/schedule/event/nim_hpcfrompy... The big issue Nim faces isn't performance but rather the relative community sizes, and thus how many libraries are available (and also how much help you might find when you run into problems).
- drbaba 3y agoFollowing up on this: As someone who uses Python with NumPy/SciPy heavily, are there any Nim libraries that would make the transition smooth? Libraries that can help with e.g. sparse matrices, linear algebra, differential equations, etc.
- pointystick 3y agoI've not used them myself but there was an effort to group these kinds of libraries in a common 'SciNim' community: https://github.com/SciNim https://github.com/SciNim https://scinim.github.io/getting-started/ https://scinim.github.io/getting-started/ Generally, projects created by Mamy Ratsimbazafy (mratsim) are a good start since he's very adept at optimisating data science-related libraries. You might want to ask in the #science channel of the Nim Discord server since although it's often quiet, that's where people working on these repositories hang out.