Measuring Performance

submited by
Style Pass
2024-10-05 02:00:02

Nobody likes waiting for code to finish compiling. Today, Rust's Cranelift backend can be used to make debug builds faster, but there's still room for improvement. I spent the last few months working on a register allocator which, when used with Cranelift, speeds up the Rust compiler by up to 18%.

I've finally completed the allocator and my PR has been merged. It ended up being pretty similar to the one described in the previous post; a description of the final state of the algorithm can be found here.

Of course, performance engineering is a complex topic that can't be fully described with a single number. The rest of this post goes into some detail about the performance measurements and how to replicate them.

Here's a snapshot of running the Rust compiler benchmarks, comparing the speed of the compiler using Cranelift with the main Ion allocator vs Fastalloc:

The picture shows the performance improvements measured with the no. of instructions metric for the primary benchmarks. Some parts of the primary benchmarks failed because my computer doesn't support LTO.

Leave a Comment