How A 1 Character Code Change Helped A Meta Engineer Save 15,000 Servers Per Year

Engineers can often need to toil for weeks to eke out the smallest bit of performance improvement in their code, but every one in a while, the smallest of changes can make a massive difference.

A Meta engineer has managed to save the company 15,000 servers worth of capacity per year by changing a single character in its codebase. The engineer added a ‘&’ sign before some bits of code, which changed how data was stored within Meta’s servers. This change saved the company 15,000 servers worth of capacity per year.

“A seasoned performance engineer was looking through Strobelight data and discovered that by filtering on a particular std::vector function call (using the symbolized file and line number) he could identify computationally expensive array copies that happen unintentionally with the ‘auto’ keyword in C++,” Meta software engineer Jordan Rome said.

The engineer found one of these array copies in the path of Meta’s major ad services. He determined that the vector copy wasn’t intentional, and the code could be made more efficient with a reference instead. So he added an & before the auto keyword. This prevented unnecessary data duplication on Meta’s servers.

Writing ‘auto’ before assigning a variable in C++ tells the compiler to create copies of the variable. On the other hand, if one appends an ‘&’ sign before ‘auto’, it merely creates a reference — it doesn’t actually duplicate the data, but simply points to it. This prevents data duplication and saves space.

With auto
With an & before auto, it creates a reference

“It was a one-character commit, which, after it was shipped to production, equated to an estimated 15,000 servers in capacity savings per year,” said Rome.

This anecdote is particularly interesting at a time when many believe that ‘vibe coding’ — non-technical people simply telling AI systems what they want, and the AI writing the code — is the newest thing going around. People are writing their own apps and websites with no programming background, and are managing to find some great results. But it’s unclear if AI would be able to find inefficiencies like the one the Meta engineer found in a massive codebase, and be able to fix it. And experienced engineers — at least for now — can more than earn their pay with sometimes just a single-character commit to their codebases.