How to make a fast dynamic language interpreter
zef-lang.dev - 181 poäng - 30 kommentarer - 38187 sekunder sedan
Kommentarer (10)
- pansa2 - 17570 sekunder sedanIn a similar vein, see this page about the performance of the interpreter for the dynamic language Wren: https://wren.io/performance.html
Unlike the Zef article, which describes implementation techniques, the Wren page also shows ways in which language design can contribute to performance.
In particular, Wren gives up dynamic object shapes, which enables copy-down inheritance and substantially simplifies (and hence accelerates) method lookup. Personally I think that’s a good trade-off - how often have you really needed to add a method to a class after construction?
- jiusanzhou - 15767 sekunder sedanThe jump from change #5 to #6 (inline caches + hidden-class object model) doing the bulk of the work here really tracks with how V8/JSC got fast historically — dynamic dispatch on property access is where naive interpreters die, and everything else is kind of rounding error by comparison. Nice that it's laid out so you can see the contribution of each step in isolation; most perf writeups just show the final number.
- tnelsond4 - 4468 sekunder sedanI use the bounds checker in TCC to check for memory errors in C, should I switch to Fil-C instead to debug my code? Obviously yolo-C is my target.
- grg0 - 34110 sekunder sedanInteresting, thanks for sharing. It is a topic I'd like to explore in detail at some point.
I also like how, according to Github, the repo is 99.7% HTML and 0.3% C++. A testament to the interpreter's size, I guess?
- catlifeonmars - 5040 sekunder sedanDo you run an optimization pass on the AST between parsing and evaluation?
- injidup - 19256 sekunder sedanWhat is this YOLO-c++ compiler that is referenced in the article? Google searches turn up nothing and chatgpt seems not to know it either.
- tiffanyh - 27798 sekunder sedanI see Lua was included, wish LuaJIT was as well.
- boulos - 29238 sekunder sedanHow's your experience with Fil-C been? Is it materially useful to you in practice?
- valorzard - 14865 sekunder sedanDo you think this exercise has taught you anything that could make fil c itself better?
- Futurmix - 32201 sekunder sedan[flagged]
Nördnytt! 🤓