Ask HN: Why do mainstream dynamic languages not ship with compilers?
I often wonder how one-man projects like Gambit/Chicken Scheme come with static compilers that produce small and efficient binaries but in the world of mainstream languages like Python/Ruby/JS this is basically unheard of?
Do Python/Ruby/JS programmers not like small, fast binaries?
7 comments
[ 3.1 ms ] story [ 25.4 ms ] threadEven pypy[0], which isn't a simple compiler by any means, is only 4.4 times faster than cpython by their own measurements.
In short, languages like cpython aren't slow because they are interpreted, they are slow because they are dynamic. There's a lot happening "under the hood".
[0] https://www.pypy.org/
The claim that Python is slow because of its nature rather than its implementations is wrong and flawed.
PyPy is pretty fast. Python compiled to Chicken Scheme / SBCL should be in the same ballpark, if not faster.
Yes, after almost 60 years of compiler development. PyPy may get there in another 40 years.
> The claim that Python is slow because of its nature rather than its implementations is wrong and flawed.
The python core developers don't lack in brain power. If it's just a matter of poor implementation then cpython would be much faster than it is. Or do you claim the core developers are incompetent?
> PyPy is pretty fast.
The PyPy people only claim 4.4 times faster than cpython, which is itself about 20 times slower than C on comparable code and much slower in many cases, so "pretty fast" is questionable. Still, in 40 year's time maybe cpython will match the fast languages, but I doubt it.
https://github.com/Nuitka/Nuitka
Also, a 4.4 times boost in case of pypy is enormous. It translates to 4x less energy, 4x less resources to manage, 4x less operational costs, etc
The goal is not to have the fastest implementation, but a fast enough implementation that can be distributed easily.
Other attempts like Cython already exist. Perhaps you believe they missed something obvious? This is an excellent way to advance the state-of-the-art when you finish your compiler.