Blog / Compiler

Why I replaced a working compiler

The engine began with no compiler at all. Then it borrowed a good one. On 17 October I took that out and kept my own.

1 view

Passed on: Keep the one that worked Chose: Keep my own

When I started the engine on 2 July 2026, its JavaScript ran on an interpreter alone. That was on purpose. Without a compiler, the engine never needs memory that is both writable and executable, which removes a whole class of security bugs.

I liked that design. It felt clean. It did not last. People compare a browser on speed, and an interpreter could not keep up. On 21 July I added Cranelift, a good open-source compiler, and simple loops got 20 to 28 times faster.

It was the right call at the time, and I was relieved. The engine suddenly felt alive.

What changed

Cranelift is built to produce good code, and that takes time. On a browser, compile time comes out of your wait. In October I measured a real news site: compiling all of its functions would have taken 1.8 seconds, so the engine was only compiling 13 of 348.

A small test compiler of my own handled the same kind of code 290 to 780 times faster and used far less memory per function. That was a narrow test, but it showed where the time was going.

1.8 sto compile one news site
13 of 348functions it could afford
290 to 780xfaster in my small test

I remember staring at those numbers. There was nothing wrong with Cranelift. It was doing exactly what it was built to do. It just was not built for this, and I could feel the decision coming before I wanted to make it.

The decision

On 13 October Floati's own compiler shipped in version 0.1.354. On 16 October I set the goal of removing Cranelift completely. On 17 October it was gone on both ARM64 and x86-64, and the engine got 2.45 MB smaller.

It is a strange feeling to delete something that works. A working part is safety. When it is gone, every bug is yours, and there is nothing to fall back on. I felt that when I removed it.

The reason is simple.

A browser spends its life running JavaScript.

If that part is mine and I finish it properly, I can stop coming back to it. That was the thought that settled it for me. I did not want to do this twice.

Where it stands

The compiler is mine now. It is still behind the fastest runtimes on some kinds of work, and closing that gap is the next job. I am not embarrassed by that. I would rather be honest about a gap I can close than comfortable with one I cannot.

Talk about this post on the forum

More decisions