8 ms·
What prevents someone from “just” making a sort-of JIT compiler by converting Python to JavaScript at runtime and then running the generated JS through V8? Then
by mathiasgredal 3y ago
What prevents someone from “just” making a sort-of JIT compiler by converting Python to JavaScript at runtime and then running the generated JS through V8? Then you could reuse a lot of the optimizations in these JS engines, and the interface between them could just be a thin translation layer between the two languages.
- papercrane 3y agoProbably the same problem that prevents a JVM based Python from being popular. There are many popular libraries that use C extensions. Without those the platform isn't usable for many use cases, and it just becomes a niche platform.
- lozenge 3y agoThe optimisations are around the javascript types, such as the number (float) and the object (which has string properties, a prototype chain, etc). Once you have to express all the Python semantics, like arbitrary precision integers or multiple inheritance, the optimisations no longer "skip" much of the work.