Butterball Part IV (aka Still That Fucking Project)

Butterball Part IV (aka Still That Fucking Project)

by ferris

This week I spent even more time with that fucking blitz basic compiler/interpreter!

The big thing this week was finishing the optimization stuff I started last week. The system now compiles the AST into an IL and resolves basically all names in the process (among other things), which sped things up by a factor of 5 or so. This is actually a bit disappointing, though; I was hoping for an order of magnitude perf improvement from this, but I suppose it's still a win nonetheless. What remains on that end is to just flatten/resolve more stuff during compilation to make the interpreter even simpler; beyond that we're approaching the upper bound with this interpretation approach, and the only way we can really gain any more perf would probably to be to compile to some bytecode, whether that be one I make up for this (unlikely) or something that can be JIT'd like LLVM (even less likely), so I probably won't end up doing that.

But, there's still some code cleanup I'm interested in doing, as well as filling out more of the original API. It'll still be rad if I can get the original 3D Overload demo running, but I've relaxed that goal at this point, as it's much less motivating to try to get there with the current approach after its somewhat-disappointing performance. Even if we do get it working, it'll probably be REALLY slow, and there are a couple really key features missing before that happens (the primary one being custom data types, which will require a bit of work).

So, unless I fill out some more of the original API and get a couple more effects running, this will be the last post I do on this project. It's been pretty fun, though, so definitely worth doing. It's also been really cool to see what it's like to build a compiler with Rust, and I must say it's been really nice! Much more comfortable than doing one in C#/C/C++, and I haven't really done much other compiler work in other languages (minus a tiny stint in F#, but I don't consider that significant enough for comparison). So yeah, fun stuff :)