Comment by damjon
Comment by damjon 15 hours ago
I've been comparing various platforms and discussing them with ChatGPT—for instance, why Python's execution is slower than JavaScript's V8. It claimed this is due to mtechnical debt and the inability to change because libraries like NumPy bypass public interfaces and access data directly.
I'm wondering how much of that is true and what is just a hallucination."
Btw: JavaScript seems to have similar complexity issues.
Edit: Python has no JIT
If we are being very pedantic, languages don't have "speed", only implementations do.
Of course in the real life there are de facto implementations and language features give way to better/worse tradeoffs.
With that out of the way, Python is basically the de facto glue language. It is very often used to provide a scripting API over lower level C libraries. To be ergonomic in this function, CPython (the major implementation) exposed some internal details of its execution model, which C libraries can reach into. This makes it very hard to make more aggressive optimizations, as one example a C library can just increase/decrease the reference count of an object. Another design decision (that got some discussion recently) is the GIL (global interpreter lock) that makes python much less competitive than something like Java. (JS also does a single thread of execution, though there are ways around it).
JS has a different use case, so access to the C world doesn't impose such restrictions on it.