To do that you first need to have a way of extending JavaScript with C and/or Fortran. No way numpy can be implemented in pure js or python without being excruciatingly slow.
They must be doing something else with numpy as Python has a generic API, that allows direct access to data of numpy array-like structures: Buffer Protocol https://docs.python.org/3/c-api/buffer.html
Numpy has a very poor API compared to Julia, Matlab, Mathematica, R. That’s just me comparing to the ones I know. It’s a mishmash of methods and functions, in-place operations and non-modifying operations, confusing indexing and broadcasting API. There are much better things available for array manipulation.
Not everything is amenable to numpy and it's pretty easy to make performance worse by throwing numpy at every problem. For example, if your array contains Python objects that are part of an operation, you've likely just introduced a significant performance regression. Worse, there's no way to detect these regressions except to have performance tests. Please, don't understate GIL issues.
numpy allows you to do some pretty low level stuff (like creating buffer from a raw pointer), which GAE wants to avoid for obvious security issues. Same rationale as why ctypes (parts of the stdlib) is not available.
I have never used numpy on GAE, but I would suspect some of it is not enabled for those reasons.
So rather than spend 10-20 minutes reading about numpy, the author wrote 3 other implementations...?
The fact that they ran the C code without the optimisation flags and compared it that way makes me think Javascript was what they actually wanted to write this one in anyway.
Thank you! So this looks interesting but it seems like there's no easy way to share numpy arrays?
The main use case for a language other than python is a more robust codebase but also performance. We need to be able to efficiently ship lots of large arrays between the languages and the Rust-Python interop supports zero copy arrays for example.
> JavaScript frontends are becoming unnecessarily bloated
reply