
Python vs. NumPy vs. Nim - narimiran
https://narimiran.github.io/2018/05/10/python-numpy-nim.html
======
narimiran
Author here.

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

~~~
cicero
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?

~~~
narimiran
> _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.

------
amai
What about Numba and Cython?

~~~
narimiran
> _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...](https://github.com/henryiii/framework_compare/tree/master/lin_regression)

\----

> What about Cython?

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

