Introduction
In the software development world, time is a precious resource. Every second saved in the development cycle—edit, compile, debug—is another opportunity to innovate. Yet, despite decades of optimization, the linking process remained a bottleneck, especially for large C++ programs. This is where mold steps in, as a paradigm shift in how linking is managed.
The Problem with Traditional Linkers
Traditional linkers, like GNU ld and even more recent ones like lld, have always exploited parallelism in a limited way. During the linking process, a significant portion of CPU cores remains idle, slowing down the process. This is primarily due to architectural constraints such as entangled symbol resolution and archive processing, which prevent effective scalability.
The Innovation of mold
Mold, developed by Rui Ueyama, introduces a radically different approach by systematically applying data parallelism across the entire linking pipeline. By decoupling symbol resolution and archive processing, mold fully leverages the capabilities of modern CPUs.
Impressive Performance
On large real-world programs, mold can link multi-gigabyte debug binaries in a few seconds, often less than a second. Comparatively, it is 2.4 to 16.1 times faster than the state-of-the-art lld linker and up to 112 times faster than the traditional GNU ld.
Ablation Study: Cumulative Optimization
An ablation study reveals that no single optimization dominates mold’s speedup. It is the cumulative effect of parallelizing all passes that allows such gains. Each stage of the linking process is optimized to take advantage of parallelism, thus maximizing the use of available hardware resources.
Implications for Software Development
With such a reduction in link times, developers can iterate much faster, resulting in a shorter development cycle and accelerated time-to-market. For large tech companies, this translates into significant time and cost savings.
Conclusion
Mold is not just an incremental improvement; it is a major breakthrough in software development. By eliminating traditional linking bottlenecks, mold enables developers and companies to focus on innovation rather than waiting.
Let's discuss your project in 15 minutes.