meta/folly
View on GitHub ↗ ★ 30,556 C++
An open-source C++ library developed and used at Facebook.
144 mentions on Hacker News by 90 people: 15 stories, 129 comments · first 2012-06-02 · latest 2026-01-14
20082026
-
…trials and look at the minimum observed time, which is when there will have been ~no interruptions. https://github.com/facebook/folly/blob/main/folly/docs/Bench...
comment by loeg · 2026-01-14 · in A 40-line fix eliminated a 400x performance gap -
…Not saying those are precisely on point, though; just thought some of the ideas were similar. [0]: https://github.com/facebook/folly/blob/main/folly/docs/Poly.... [1]: https://github.com/microsoft/proxy
comment by aw1621107 · 2025-12-19 · in Common Rust Lifetime Misconceptions -
…Folly's definition [1]. [0] https://community.intel.com/t5/Intel-Moderncode-for-Parallel... [1] https://github.com/facebook/folly/blob/d2e6fe65dfd6b30a9d504...
comment by charleshn · 2025-12-08 · in Spinlocks vs. Mutexes: When to Spin and When to Sleep -
…in C++ in a very similar way as Rust. E.g., APIs can take folly::Synchronized<T>::RLockedPtr: https://github.com/facebook/folly/blob/76f81836a2ccb6cd3bc7d...
comment by loeg · 2025-09-23 · in The allure of new languages vs. the necessity of problem-solving -
…mostly historical, though it's relatively common to use a 128 byte line size on x86, still. E.g., https://github.com/facebook/folly/blob/main/folly/lang/Align... (Sandy Bridge was a 2011 CPU). (Clang's impl of the std version of these…
comment by loeg · 2025-09-15 · in Analyzing the memory ordering models of the Apple M1 -
…every single time they need to do some basic things (like for example version upgrades). Example: https://github.com/facebook/folly/blob/main/build.sh
comment by dev_l1x_be · 2025-09-15 · in RustGPT: A pure-Rust transformer LLM built from scratch -
https://github.com/facebook/folly/blob/main/folly/chrono/Har...
comment by loeg · 2025-08-16 · in OpenBSD is so fast, I had to modify the program slightly to measure itself -
…on escape-heavy strings. [1] https://source.chromium.org/chromium/_/chromium/v8/v8/+/5cbc... [2] https://github.com/facebook/folly/commit/2f0cabfb48b8a8df84f...
comment by ot · 2025-08-04 · in How we made JSON.stringify more than twice as fast -
Bingo. https://github.com/facebook/folly/commit/4d932ecc53c7a722671...
comment by loeg · 2025-05-07 · in Matt Godbolt sold me on Rust by showing me C++ -
…[3]: https://research.facebook.com/publications/hive-a-warehousin... [4]: https://github.com/facebook/folly/tree/main
comment by smitelli · 2024-12-04 · in Meta built large-scale cryptographic monitoring -
…some are better at certain workloads than the rest. DistributedMutex and SharedMutex come to mind ( https://github.com/facebook/folly/blob/main/folly/synchroniz... , https://github.com/facebook/folly/blob/main/folly/SharedMute... ) Just…
comment by uvdn7 · 2024-10-02 · in The Fastest Mutexes -
…look at it? Wondering if there are any advantages. The api seems fairly similar to me at a glance. https://github.com/facebook/folly/tree/main/folly/experiment...
comment by dkasper · 2024-09-26 · in Show HN: Coros – A Modern C++ Library for Task Parallelism -
…disprove your wrong assertions as opposed to providing references that justify your position: Folly https://github.com/facebook/folly : "It complements (as opposed to competing against) offerings such as Boost and of course std. In fact,…
comment by Maxatar · 2024-08-06 · in C++'s `noexcept` can sometimes help or hurt performance -
…used to test its core synchronization primitives, but I don't think it's as sophisticated as loom. https://github.com/facebook/folly/blob/main/folly/test/Deter...
comment by ot · 2024-07-06 · in Properly testing concurrent data structures -
Easily solved manually reserving exponentially. All my projects use some variation of this: https://github.com/facebook/folly/blob/9f125c94e10fd01f5567c... But I've burned myself on this a few times before.
comment by mandarax8 · 2024-06-09 · in Compilers are too smart -
Modern hash table implementations use vector instructions for lookups: - Folly: https://github.com/facebook/folly/blob/main/folly/container/... - Abseil: https://abseil.io/about/design/swisstables
comment by alexhutcheson · 2024-06-04 · in Intel's Lion Cove Architecture Preview -
Nope, given that it has a plugin architecture and in time it would have been everywhere. https://github.com/facebook/folly/commit/b1391e1c57be71c1e2a...
comment by pajko · 2024-03-31 · in Ask HN: How bad is the xz hack? -
yes, like this one: https://github.com/facebook/folly/pull/2153
comment by jdright · 2024-03-30 · in Backdoor in upstream xz/liblzma leading to SSH server compromise -
…correct.) And if they don't need the 2nd load on Linux, I'm unclear on why they do it. [0]: https://github.com/facebook/folly/blob/main/folly/synchroniz... (This uses either mprotect to force a TLB flush in process-relevant CPUs, or the…
comment by loeg · 2024-03-01 · in A lock-free ring-buffer with contiguous reservations (2019) -
…but uses some sort of SeqCst barrier between the store and the 2nd load (with acquire semantics): https://github.com/facebook/folly/blob/main/folly/synchroniz...
comment by loeg · 2024-03-01 · in A lock-free ring-buffer with contiguous reservations (2019) -
folly provides functions to resize std::string & std::vector without initialization [0]. [0] https://github.com/facebook/folly/blob/3c8829785e3ce86cb821c...
comment by terrelln · 2023-10-27 · in Appending to an std:string character-by-character: how does the capacity grow? -
It is doable, `folly::Expected` supports that: https://github.com/facebook/folly/blob/main/folly/test/Expec...
comment by ot · 2023-09-30 · in How to Use Monadic Operations for `std:optional` in C++23 -
…With BMI2 you can also use the PDEP instruction to accelerate the final select on a 64-bit block: https://github.com/facebook/folly/blob/main/folly/experiment...
comment by ot · 2023-07-02 · in A compressed indexable bitset -
…was a non-negotiable. [1] https://github.com/ot/ds2i/ [2] https://github.com/pisa-engine/pisa [3] https://github.com/facebook/folly/blob/main/folly/experiment...
comment by ot · 2023-07-01 · in A compressed indexable bitset -
C++ with folly's SCOPE_EXIT {} construct: https://github.com/facebook/folly/blob/main/folly/ScopeGuard...
comment by loeg · 2023-06-21 · in Defer for Shell (2020) -
…that read it very frequently (typical use case is configs). The most performant solutions are RCU ( https://github.com/facebook/folly/blob/main/folly/synchroniz... ) and hazard pointers ( https://github.com/facebook/folly/blob/main/folly/sy…
comment by ot · 2023-06-18 · in A single line of code made a 24-core server slower than a laptop (2021) -
…folly C++ library was something I'd point to for my junior engineers to get a sense of "good" C++ https://github.com/facebook/folly
comment by personjerry · 2023-06-17 · in Ask HN: What are some of the most elegant codebases in your favorite language? -
…in the standard library this even spells out that the result has "at least the specified capacity" https://github.com/facebook/folly/blob/main/folly/container/... F14 is a linear map but I couldn't immediately find actual API…
comment by tialaramex · 2023-04-12 · in Deduplicate a slice in Go, use sort or a map? -
…com/SerenityOS/serenity/blob/master/Kernel/Lo... I don't know why the article doesn't touch on these. https://github.com/facebook/folly/blob/main/folly/docs/Synch... https://github.com/facebook/folly/blob/main/folly/Synchroniz...
comment by loeg · 2023-04-06 · in MutexProtected: A C++ Pattern for Easier Concurrency -
…? https://en.cppreference.com/w/cpp/atomic/atomic * folly::Synchronized, mentioned by ot57? https://github.com/facebook/folly/blob/main/folly/docs/Synch... * Boost synchronized data structures, -mentioned by mchicken 53?…
comment by einpoklum · 2023-04-06 · in MutexProtected: A C++ Pattern for Easier Concurrency -
…object. It is generally the preferred synchronization utility at Meta and thus it is widely used. https://github.com/facebook/folly/blob/main/folly/docs/Synch...
comment by ot · 2023-04-06 · in MutexProtected: A C++ Pattern for Easier Concurrency -
https://github.com/facebook/folly/blob/main/folly/docs/Synch...
comment by ajtulloch · 2023-04-06 · in MutexProtected: A C++ Pattern for Easier Concurrency -
…people use Result in Rust. (And C++ std::optional<T> is somewhat similar to Rust's Option<T> type.) https://github.com/facebook/folly/blob/main/folly/Expected.h...
comment by loeg · 2023-03-14 · in Switching from C++ to Rust -
You have to use something similar to https://github.com/facebook/folly/tree/main/folly/experiment... to solve this problem. It's a nasty bug that everyone encounters when first working with coroutines. (Similarly everyone will encounter…
comment by somerando7 · 2022-10-04 · in C++20 coroutines: “The bug is in the C++ standard, not GCC.” (2020) -
https://github.com/facebook/folly/blob/main/folly/docs/Packe... is pretty awesome and I’ve personally gotten big wins from it. The parent mentioned Bloom Filters, HyperLogLog-type stuff is on that family tree and also very interesting and…
comment by benreesman · 2022-07-22 · in Ask HN: What are some cool but obscure data structures you know about? -
…for this (see folly::dynamic[1]). We make extensive use of this at my (non-Facebook) job. [1] https://github.com/facebook/folly/blob/master/folly/docs/Dyn...
comment by ollien · 2022-05-26 · in Parsing JSON faster with Intel AVX-512 -
https://github.com/facebook/folly/blob/main/folly/docs/Overv... This has library contents: it’s a mix of various utilities - type conversion, data structures, memory management, random numbers, concurrency, etc.
comment by ximeng · 2022-01-07 · in Folly: An open-source C++ library developed and used at Facebook -
The docs have a bit more detail about what is included: https://github.com/facebook/folly/blob/main/folly/docs/Overv...
comment by MarkSweep · 2022-01-07 · in Folly: An open-source C++ library developed and used at Facebook -
Ideally they should be turned into open source projects. Google's https://abseil.io and Facebook's https://github.com/facebook/folly come to mind.
comment by floatboth · 2021-12-25 · in Fix the unit test and open a giant hole everywhere -
…callable and can be moved but not copied). That's often preferable for storing functors. Example: https://github.com/facebook/folly/blob/main/folly/docs/Funct...
comment by MauranKilom · 2021-12-13 · in The Evolutions of Lambdas in C++14, C++17 and C++20 -
…For example, Facebook's Folly has been updated to use coroutines and is being widely adopted at FB: https://github.com/facebook/folly/tree/main/folly/experiment...
comment by pavlov · 2021-11-01 · in C++ Coroutines Do Not Spark Joy -
…an even better performance implementation using sqrt. Might make sense to port that over to Rust. https://github.com/facebook/folly/blob/master/folly/stats/TD...
comment by rogers18445 · 2021-09-15 · in How percentile approximation works and why it's more useful than averages -
Edit: Links to repos: https://github.com/pytorch/pytorch https://github.com/tensorflow/tensorflow https://github.com/facebook/folly
comment by pdevr · 2021-08-24 · in Ask HN: What are the best publicly available FAMANG code repos? -
For example folly's vector performs this optimization: https://github.com/facebook/folly/blob/master/folly/docs/FBV...
comment by kevincox · 2021-06-15 · in Linux with “memory folios”: a 7% performance boost when compiling the kernel -
…) good ( https://software.intel.com/content/www/us/en/develop/documen... ) options ( https://github.com/facebook/folly/tree/master/folly/concurre... ) out there." There are plenty of practical solutions to the safe memory reclamation…
comment by pkhuong · 2021-06-01 · in Libdill: Structured Concurrency for C (2016) -
…ticks? http://www.cs.columbia.edu/~nahum/w6998/papers/sosp87-timing... Production implementation: https://github.com/facebook/folly/blob/master/folly/io/async...
comment by EquallyJust · 2021-05-25 · in Need Something Sorted? Sleep on It -
folly::Function was added for exactly this reason I think https://github.com/facebook/folly/blob/master/folly/docs/Fun...
comment by aptxkid · 2021-04-16 · in Why C++ Is Terrifying -
…1.5, any growth factor below 2 has this property, how far below 2 regulates how quickly it happens, https://github.com/facebook/folly/blob/master/folly/docs/FBV... > it can be mathematically proven that a growth factor of 2 is rigorously…
comment by masklinn · 2021-04-14 · in Is WebAssembly magic performance pixie dust? -
…Facebook's Folly library also provides type erasure functionality: https://github.com/facebook/folly/blob/master/folly/docs/Pol... Google's Abseil is full of type erasure: https://abseil.io/ Here is Adobe's C++ library for ty
comment by Kranar · 2021-03-13 · in An Object-Oriented Language for the '20s -
…of the standard library you find is better than third party options. [1] https://abseil.io/ [2] https://github.com/facebook/folly [3] https://github.com/electronicarts/EASTL [4] https://www.boost.org/
comment by Kranar · 2021-03-09 · in “ISO obstructs adoption of standards by paywalling them”