3 ms·
> There is an inherent overhead to all dynamically typed languages like Ruby and Python, method dispatch I can't claim to fully understand how they pull it off
by vanderZwan 12y ago
> There is an inherent overhead to all dynamically typed languages like Ruby and Python, method dispatch
I can't claim to fully understand how they pull it off (not being that familiar with compiler internals), but I thought Julia didn't suffer from this problem?
- chrisseaton 12y agoMost of the problems with these languages were pretty much solved several decades ago - it's just that most language implementations don't use the techniques as they need a JIT that supports dynamic deoptimization [1], which is non-trivial to implement. [1] U. Hölzle, C. Chambers, and D. Ungar, “Debugging optimized code with dynamic deoptimization,” presented at the PLDI '92: Proceedings of the ACM SIGPLAN 1992 conference on Programming language design and implementation, New York, New York, USA, 1992, pp. 32–43.
- ihnorton 12y agoJulia is really designed to feel dynamic while minimizing the run-time dynamicity the compiler must account for. Type inference and method specialization play a big role, and you can read the Julia papers (on julialang.org) for a discussion of many of the design choices. Many modern JIT compilers use multiple techniques for aggressive specialization of code sections that meet optimization heuristics (whether tracing-based or otherwise), thus carefully written JavaScript (under V8 and others), Lua (under LuaJIT) and Python (under PyPy and others) can be quite fast. On these platforms there are usually implicit or explicit language subsets and coding styles required to get maximum performance out of the compiler (as with Julia: it is possible to write slow code in any language). For example, ASM.js is an optimization-friendly, explicit subset of JavaScript.