How to make a fast dynamic language interpreter

5 hours ago (zef-lang.dev)

I see Lua was included, wish LuaJIT was as well.

  • I bet LuaJIT crushes Zef! Or rather, I would hope that it does, given how much more engineering went into it

    There are many runtimes that I could have included but didn’t.

    Also, it’s quite impressive how much faster PUC Lua is than QuickJS and Python

    • Because QuickJS is really slow. Don't be fooled by the name. It's almost an order of magnitude slower than node/v8.

      (I suppose the quick in QuickJS means "quick for a pure interpreter without JIT compilation or something...)

      1 reply →

    • > it’s quite impressive how much faster PUC Lua is than QuickJS and Python

      Python's execution time is mostly spent looking up stuff. I don't think lua is quite as dynamic.

      2 replies →

Interesting, 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?

  • I committed the statically generated site, which is wastefully large because how I generate the code browsers

    But yeah the interpreter is very small

How's your experience with Fil-C been? Is it materially useful to you in practice?

  • I’m biased since I’m the Fil.

    It was materially useful in this project.

    - Caught multiple memory safety issues in a nice deterministic way, so designing the object model was easier than it would have been otherwise.

    - C++ with accurate GC is a really great programming model. I feel like it speeds me up by 1.5x relative to normal C++, and maybe like 1.2x relative to other GC’d languages (because C++’s APIs are so rich and the lambdas/templates and class system is so mature).

    But I’m biased in multiple ways

    - I made Fil-C++

    - I’ve been programming in C++ for like 35ish years now

    • I’m curious. Given the overheads of Fil-C++, does it actually make sense to use it for greenfield projects? I like that Fil-C fills a gap in securing old legacy codebases, I’m just not sure I understand it for greenfield projects like this other than you happen to know C++ really well.

      1 reply →