Urgent.News

What's breaking now, across thousands of outlets.

Tech

I made a build visualizer to understand Bun's compile times

Article URL: https://lalitm.com/post/buildprof/ Comments URL: https://news.ycombinator.com/item?id=49672842 Points: 159 # Comments: 30

A developer created a tool called buildprof to visualize the build process and understand the time taken by the compiler. The tool generates a timeline showing process durations, child processes, and their relationships. Buildprof was inspired by a tweet comparing the compile times of Bun's Rust and Zig builds. The creator wanted to investigate what caused the difference in build times, particularly the long linker time in the Zig build.

By using buildprof to trace the process tree of the Zig build, it was discovered that the linker (ld.lld) took over sixteen minutes to complete with Full LTO (Link Time Optimization). Full LTO combines all compilation units into one large optimization job, while ThinLTO preserves more separation between units, allowing for better parallelism.

After enabling compiler traces in the linker, it became clear that Full LTO was responsible for most of the build time. Comparing the Rust and Zig builds with buildprof revealed that the Rust build took significantly less time, even with Full LTO enabled. Switching the Zig build to use ThinLTO resulted in a much shorter linker time, closing a significant portion of the gap between the two builds.

This tool provides a detailed timeline of the build process, helping developers identify bottlenecks and optimize their builds.

Written by urgent.news from Hacker News Best's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at lalitm.com →

More in Tech

More from Saturday 12 September →