Facebook is looking to help engineers accelerate their large-scale applications with BOLT. The company announced it is open sourcing the binary optimization and layout tool this week.

According to Facebook, BOLT can be used for optimizing placement of instructions in memory, and is designed to reduce CPU execution time by two to 15 percent, though in most cases it reduces it by eight percent.

“Highly complex services, such as those here at Facebook, have large source code bases in order to deliver a wide range of features and functionality. Even after the machine code for one of these services is compiled, it can range from 10s to 100s of megabytes in size, which is often too large to fit in any modern CPU instruction cache. As a result, the hardware spends a considerable amount of processing time — nearly 30 percent, in many cases — getting an instruction stream from memory to the CPU,” Maxim Panchenko, software engineer at Facebook, wrote in a post.

When designing BOLT, the company looked to satisfy three requirements: it needed to be compatible with code generated by any compiler, able to support code that did not have available source code, and it needed to able to support code manually written in assembly to optimize its layout.

BOLT rearranges code inside functions based on their execution profile, the company explained. The body of the function is split based on how frequently the code is executed, and then it performs and optimal layout of hot chunks of code depending on the call graph profile.

In addition to improving code layout, BOLT performs optimizations utilizing the application profile and exploiting machine code, such as advanced jump table placement, identical code folding, PLT optimization, and constant load elimination.

“We are open-sourcing BOLT and will be happy to work with the community to help accelerate its applications. If you are running a large application that is CPU front-end bound — i.e., it experiences a significant amount of instruction cache and TLB misses — then BOLT will help address these bottlenecks,” Facebook wrote in a post.