Hacker News new | past | comments | ask | show | jobs | submit login
Python vs. NumPy vs. Nim (narimiran.github.io)
18 points by narimiran on May 11, 2018 | hide | past | web | favorite | 6 comments



Author here.

If you have any questions and/or comments about Nim, I'm ready to answer.


At this stage in my career, Python is my most used language, but I would prefer static typing (ideally with type inference) and native executables. I've been learning Haskell for that reason, but I see that Nim would also fulfill those requirements. How does Nim compare with Haskell, including its maturity and community?


> How does Nim compare with Haskell, including its maturity and community?

Nim is not as mature nor battle-tested as Haskell. Haskell has more users and it is more widely spread, so it would be a safe(r) bet.

I'm also coming from Python, and I have tried several languages (including Haskell) until I kinda settled with Nim.

I really like the similarities in the syntax between Nim and Python, which allows me to easily transfer my "Python thinking" into Nim code. There is also a possibility to only translate some slow/CPU-intensive parts of Python code to Nim, and then call it from Python (FFI).

Regarding community - the Nim community (IRC/Gitter) has been very welcoming to me and to my beginner/dumb questions - I guess this is the advantage of a small community - there's a sense of a connection and people want to help each other.


What about Numba and Cython?


> What about Numba?

I'll copy-paste my Reddit comment:

Like pypy, numba was also on my radar, but I couldn't make it work by just slapping `@jit` decorator to the original code, and I didn't want to go into figuring out what's wrong nor making modifications to the original code.

>> I suspect it should be on par with Nim.

Somebody else [0] has run a comparison including Numba, where Numba is 1.5x faster than NumPy.

This means, if we can compare tests on the different machines, that Nim should be about 2x faster than Numba.

[0] https://github.com/henryiii/framework_compare/tree/master/li...

----

> What about Cython?

I haven't tried it. It would be interesting to see the results.


I've added several others, including C++, as well as a faster numpy implementation (avoiding mixing double and float): https://github.com/henryiii/framework_compare/tree/master/li...




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: