- Author
- Not stated
- Published
- Undated
- Kind
- Technical write-up with step-by-step benchmark results
- Original
- zef-lang.dev/implementation
- Subject
- Compilers and interpreters
- Themes
- Close to the machine
What it is
The author is not named on the page. The author built Zef for fun, compiled with Fil-C++. The post targets people starting a language implementation from scratch. It says techniques here need no bytecode, JIT or machine code.
What it says
- The post says five techniques give a 16x speed-up. They include inline caching and watchpoints.
- The original interpreter was 35x slower than CPython 3.10. It was 80x slower than Lua 5.4.7.
- The largest step was a new object model with inline caches, at 4.55x faster.
- Replacing strings with hash-consed Symbol objects gave an 18% speed-up.
- Some gains worked around Fil-C++ costs. In Fil-C++, stack values and std::optional are heap allocated.
- Compiling with plain C++ gave about a 4x further speed-up. The post calls that port unsound.
- Two changes, deduplicating code and disabling asserts, gave no speed-up despite the author's hopes.
What evidence it gives
The post reports timings for four ported benchmarks: Richards, DeltaBlue, N-Body and Splay. Each result is an average of 30 randomly interleaved runs on one Intel machine. A table shows the cumulative effect of every change, and raw seconds are given.
Interests and limits
The author chose the benchmarks. Some Python and Lua ports of Splay were written with Claude. All runs used one machine. Most comparisons set Fil-C++ builds against other interpreters built with ordinary compilers. The language is the author's own, so results may not carry to other designs.
Connections
These links are this wiki's own reading, not claims the sources make.
- Strategies for very fast Lexers. Both lexer and interpreter gain by replacing strings with something cheap to compare. Atoms become hashed numbers in one, and Symbol objects in the other. The trick carries because a name's identity matters more than its spelling.