r/Compilers • u/hxkhano • 2d ago
Evie: an interpreted programming language written in Go that keeps pace with C Lua 5.4
[Evie](https://hxkhan.github.io/evie/) is a small dynamic language I built to be embedded in Go programs. Its interpreter compiles the AST once into Go closures, so nothing inspects the tree at run time, and there's no bytecode or JIT.
On an 8-program benchmark suite (geometric mean) it comes out slightly ahead of C Lua 5.4 overall:
Evie 55.7 ms · Lua 5.4 57.5 ms · QuickJS 83.4 ms · Python 3 115.0 ms · V8 without JIT 120.7 ms
What makes it fast:
• Small values: every value is 16 bytes, with numbers stored inline and never allocated.
• Specialised operators: each operator gets a generated closure for every operand shape, such as local + constant or local + local, so the hot paths skip type dispatch.
• Dictionaries like CPython's: objects keep insertion order in a compact table, with one hash per lookup.
Lua still wins numeric loops and big dictionaries. Evie wins calls, classes and strings.
On AI use: I wrote the majority of the language myself; I've worked on state machines and VMs for 6 years. AI helped a lot but the majority is hand written by me: the user-facing error messages, the whole website, and the large parts that are mostly boilerplate rather than hard were mostly done by Claude and then verified by me.
I'd love feedback on all fronts.
Playground: https://hxkhan.github.io/evie/play/
3
u/Key_Detail15 2d ago edited 2d ago
What's a 'Go closure'? Is it data or does it contain native code?
Presumably there must be something that represents the code of a program which the interpreter executes. If it is not an AST and not bytecode then it must be something doing the same job.
And for a fair comparison with other non-JIT interpreters it needs to be data and not native code specific to a particular Evie program.
There are 'hot paths' but no JIT?
1
u/Discordbothost 2d ago
The aggregate timing makes it hard to tell how much the specialized operators contribute. Could you run the same programs with specialization off and show the times per benchmark? That would make it easier to see which speedups come from dispatch and which are elsewhere in the runtime.