7 comments

[ 3.2 ms ] story [ 21.6 ms ] thread
> when raw speed is required and the edit-compile-run cycle of binary extension modules is too heavy

This is a compelling pitch in my opinion, but can anybody explain to me where Lua would be better than, say, Numpy, or Numba for that matter, for computationally expensive tasks?

What are the use cases for this that well-known and really fast Python extensions do not already cater for?

Off the top of my head: any time you want to run a computational thing in another thread without doing something like an entire celery process or somesuch.

It's not about being THE solution for such things anyway. It's about being an option.

Those libraries are for doing fast matrix operations. Lua is a fast general purpose language.
Numpy, is that, but Numba is a general purpose JIT:

> Numba works by generating optimized machine code using the LLVM compiler infrastructure at import time, runtime, or statically (using the included pycc tool). Numba supports compilation of Python to run on either CPU or GPU hardware

http://numba.pydata.org/

The numpy analogue in lua would be torch. The community can be a little weird / insular but otherwise very interesting and full of potential
True multicore computation (although that's possible with numba's nopython mode, but it's not as general as what luajit can support).
I was just looking at lupa the other week for implementing a rule set interpreter in Python. Similar to how cloudflare uses lua for their WAS.