Back to News for Developers

ELI5: Folly - Battle-Tested C++ Library

May 24, 2021ByDmitry Vinnik

In this blog post, we explore a popular open source project called Folly, a C++ library that provides core components used extensively at Facebook. We cover this open source project using the ELI5 style of explaining things in simple terms in the shortest amount of time.

If you prefer to learn by watching, we also have an accompanying video about Folly on our Facebook Open Source YouTube channel.

Why Folly?

Here at Facebook, we use, contribute and release a number of open source projects. Unfortunately, when it came to C++, we couldn't share any of our code with the community because we had several internal, unreleased dependencies. Folly was created to fix this gap and share our open source in C++ with the world.

Folly (acronymed loosely after Facebook Open Source Library) is a library of C++14 components designed with practicality and efficiency in mind, including drop-in, optimized replacements for parts of the C++ STL.

With Folly, we emphasize speed as well as stability. As Facebook heavily relies on utilities in Folly, this library's performance and scale have been of utmost importance. It has features like in-memory JSON manipulation or string-formatting.

Despite the disparate number of components, Folly aims to make them easy and safe to use. The project relies on modern C++ and provides plenty of tools like string utilities that operate fewer CPU cycles and make code more concise.

Where is it used?

Folly was open sourced by Facebook in 2012. Since its launch, the project has been widely used worldwide, with 16 thousand followers and almost 4 thousand forks on its GitHub page.

Where can I learn more?

Would you like to learn more about Folly? The project has thorough documentation on its GitHub repository, and the Folly team has been sharing great overview posts like the Folly Futures announcement. If you want to ask the Folly community a question, we invite you to join their Google Group.

About the ELI5 series

In a series of short videos (~1 min in length), one of our Developer Advocates on the Facebook Open Source team explains a Facebook open source project in a way that is easy to understand and use.

We will write an accompanying blog post (like the one you're reading right now) for each of these videos, which you can find on our YouTube channel.

To learn more about Facebook Open Source, visit our open source site, subscribe to our YouTube channel, or follow us on Twitter and Facebook.

Interested in working with open source at Facebook? Check out our open source-related job postings on our career page by taking this quick survey.