At JuliaCon Local in Eindhoven in December 2023, Jeff Bezanson, co-creator of Julia and co-founder of JuliaHub, presented a talk on the state of Julia binaries and the goal to generate smaller ones. A common request by developers in the Julia developer survey is the ability to produce smaller, self-contained binaries. In the Eindhoven talk, Jeff shared a graph showing the progression of binary sizes generated by PackageCompiler.jl. There has been significant progress since then, and the latest update shows a huge drop in size, thanks to the trimming mechanism.
As the Julia language continues to evolve, the team behind Julia offers new methods and tools to compile Julia more efficiently to improve runtime performance, reduce binary sizes, and facilitate deployment. The JuliaCon 2024 talk on New Ways to Compile Julia by Jeff Bezanson and Gabriel Baraldi talks about these new methods that can trim unnecessary code and improve the overall system.
New Developments for Easier Code Deployment
The session introduced advancements in ahead-of-time (AOT) compilation for Julia programs with:
Introduction of ‘juliac’: The new compiler driver ‘juliac’ offers a more traditional, gcc-like command-line interface for compiling Julia programs.
Trimming: Binaries can now be “trimmed” to remove unused code, reducing the overall deployment footprint.
The --trim option can be used to produce a hello executable currently around 900 KB. While 900 KB might not seem particularly small at first, it’s significant progress compared to the current state of Julia system images, which can easily be over 100 MB, depending on the usage. This feature is a big step forward. This feature is available on a branch currently with a pull request for Julia users to try it out.
Shared Libraries: Trimming is particularly useful for building compact shared libraries. The goal for these shared libraries is to behave like C, C++, or Rust libraries and make it easier to integrate into existing workflows.
Ongoing work: Work is ongoing to further reduce binary sizes and generally improve Julia compiler tooling.
You can watch the full YouTube video of the talk here.