4 ms·
> Python is considerably more dynamic than JavaScript This is sometimes repeated but I don’t believe that is why Python is slow (nor do I think for most measur
by tgma 3y ago
> Python is considerably more dynamic than JavaScript
This is sometimes repeated but I don’t believe that is why Python is slow (nor do I think for most measures of “dynamic” it is even true). Which aspect of “dynamism” in particular are you concerned about that JavaScript lacks? The primary hindrance is keeping CPython extensions working while making Python fast. Add to that the hundreds of millions that went into V8 and other JavaScript implementation efforts.
- int_19h 3y agoFor starters, consider that almost every operator in Python is a dynamic method call under the hood. This includes value equality and hashing, which also affects e.g. dict keys. Oh, and all built-in types can be extended and their behavior overridden. And then there's descriptors: https://docs.python.org/3/howto/descriptor.html https://docs.python.org/3/howto/descriptor.html
- tgma 3y agoThose are hardly unsolvable issues with a JIT as they are static for the vast majority of cases. Solutions have been proposed since the 90s with Self and Strongtalk[1]. Doing that, plus 100% compatibility with CPython extension API, while preserving some expectations of deterministic destruction in Python, are the challenges one would face. [1]: http://www.strongtalk.org/ http://www.strongtalk.org/