optimisation

Peering through the peephole: build a peephole optimiser using the new Java 24 Class-File API

January 17, 2025 - 15:38

Originally published as part of Java Advent 2024. You can find the full code for the optimiser over on GitHub.

When you think about code optimisation, you might imagine complex analysis over entire programs, sophisticated JIT compilers, or elaborate data-flow analyses. But some of the most effective optimisations come from a much simpler technique: peephole optimisation. This approach can yield surprisingly good results with relatively little complexity.

Subscribe to optimisation