4 ms·
> compilation versus interpretation never made a sigificant difference in performance for my solutions (which tended to be dominated by algorithmic complexity c
by attractivechaos 4y ago
> compilation versus interpretation never made a sigificant difference in performance for my solutions (which tended to be dominated by algorithmic complexity concerns) ... Were I to implement a language, I think I’d favor having an interpreter first.
Constant matters. Ahead-of-time compilation (AOT) and just-in-time compilation (JIT) are a lot faster than interpretation [1,2], sometimes by a factor of >100 in the case of C vs pure python [3]. This gap is noticeable for a program taking more than a few seconds to run. Except for performance-critical tasks, my preference is JIT-based languages without a manual compilation step, such as LuaJIT, Javascript-V8/Node.js and Dart. Nonetheless, these language implementations are much harder to develop than interpreters.
[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python3-go.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
[2] https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
[3] https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python3-gcc.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- kaba0 4y agoInterpreters don’t mean the internal evaluation method here, but only the mode of operation. E.g. ruby implementations that use JIT, java’s jshell, python also has a JIT interpreter.
- sideeffffect 4y ago> Constant matters Not in these exercises. They're focused on algorithms and their asymptotic complexity.
- attractivechaos 4y agoI am not familiar with Advent of Code. If all their problems take ~0.1s to solve in C, you are probably right. However, it is a stretch to make a high-level conclusion just based on small exercises, like this: > There was never a time where rewriting in another language felt like the right way to get better performance. Similarly, for small exercise problems, dynamic typing rarely hurts, but for large collaborative projects, static typing starts to show its advantages.
- still_grokking 4y ago> Were I to implement a language […] So this was not related to AoC but instead to building a language.
- igouy 4y agoDart AOT — Dart JIT https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/dartexe-dartjit.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- attractivechaos 4y agoInteresting! Thank you for maintaining the benchmark all these years.
- still_grokking 4y agoThat's funny to see because for example for Java it's the contrary: Java code JIT compiled is usually significantly faster than when AoT compiled.