3 For a high level overview see the [README](folly/README.md)
7 Below is a list of (some) Folly components in alphabetical order, along with
8 a brief description of each.
10 #### `Arena.h`, `ThreadCachedArena.h`
12 Simple arena for memory allocation: multiple allocations get freed all
13 at once. With threaded version.
15 #### [`AtomicHashMap.h`, `AtomicHashArray.h`](AtomicHashMap.md), `AtomicHashArray.h`, `AtomicLinkedList.h`, ...
17 High-performance atomic data-structures. Many of these are built with very specific
18 tradeoffs and constraints in mind that make them faster than their more general
19 counterparts. Each header should contain information about what these tradeoffs are.
23 A Baton allows a thread to block once and be awoken: it captures a single handoff. It is
24 essentially a (very small, very fast) semaphore that supports only a single call to `sem_call`
27 #### [`Benchmark.h`](Benchmark.md)
29 A small framework for benchmarking code. Client code registers
30 benchmarks, optionally with an argument that dictates the scale of the
31 benchmark (iterations, working set size etc). The framework runs
32 benchmarks (subject to a command-line flag) and produces formatted
33 output with timing information.
37 Various bit manipulation utilities optimized for speed; includes functions
39 [ffsl(l)](http://linux.die.net/man/3/ffsll) primitives in a uniform
42 #### `ConcurrentSkipList.h`
44 An implementation of the structure described in [A Provably Correct
45 Scalable Concurrent Skip
46 List](http://www.cs.tau.ac.il/~shanir/nir-pubs-web/Papers/OPODIS2006-BA.pdf)
49 #### [`Conv.h`](Conv.md)
51 A variety of data conversion routines (notably to and from string),
52 optimized for speed and safety.
56 Pretty-printing C++ types.
58 #### `DiscriminatedPtr.h`
60 Similar to `boost::variant`, but restricted to pointers only. Uses the
61 highest-order unused 16 bits in a pointer as discriminator. So
62 `sizeof(DiscriminatedPtr<int, string, Widget>) == sizeof(void*)`.
64 #### [`dynamic.h`](Dynamic.md)
66 Dynamically-typed object, created with JSON objects in mind. `DynamicConverter.h` is
67 a utility for effeciently converting from a `dynamic` to a more concrete structure when
68 the scheme is known (e.g. json -> `map<int,int>`).
70 #### `EvictingCacheMap.h`
72 A simple LRU hash map.
74 ####[`FBString.h`](FBString.md)
76 A drop-in implementation of `std::string` with a variety of optimizations.
78 ####[`FBVector.h`](FBVector.md)
80 A mostly drop-in implementation of `std::vector` with a variety of
85 A C++ abstraction around files.
91 ### [`futures/`](folly/futures/Readme.md)
93 Futures is a framework for expressing asynchronous code in C++ using the Promise/Future pattern.
95 ####[`Format.h`](Format.md)
97 Python-style formatting utilities.
101 This library makes it possible to write declarative comprehensions for
102 processing sequences of values efficiently in C++ akin to C#'s LINQ.
104 ####[`GroupVarint.h`](GroupVarint.md)
107 encoding](http://www.ir.uwaterloo.ca/book/addenda-06-index-compression.html)
112 A collection of utilities to deal with IPAddresses, including ipv4 and ipv6.
116 A collection of useful of abstractions for high-performance io. This is heavily relied upon
117 in Facebook's internally networking code.
121 Various popular hash function implementations.
123 ####[`Histogram.h`](Histogram.md)
125 A simple class for collecting histogram data.
127 ####`IntrusiveList.h`
129 Convenience type definitions for using `boost::intrusive_list`.
133 JSON serializer and deserializer. Uses `dynamic.h`.
137 Wrappers around [`__builtin_expect`](http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html).
139 ####`Malloc.h`, `Memory.h`
141 Memory allocation helpers, particularly when using jemalloc.
143 ####`MicroSpinLock.h`
145 A really, *really* small spinlock for fine-grained locking of lots of teeny-tiny data.
149 MPMCQueue<typename> is a high-performance bounded concurrent queue that
150 supports multiple producers, multiple consumers, and optional blocking.
151 The queue has a fixed capacity, for which all memory will be allocated
154 The additional utility `MPMCPipeline.h` is an extension that lets you
155 chain several queues together with processing steps in between.
157 ####[`PackedSyncPtr.h`](PackedSyncPtr.md)
159 A highly specialized data structure consisting of a pointer, a 1-bit
160 spin lock, and a 15-bit integral, all inside one 64-bit word.
164 Necessarily evil stuff.
166 ####[`ProducerConsumerQueue.h`](ProducerConsumerQueue.md)
168 Lock free single-reader, single-writer queue.
172 Defines only one function---`randomNumberSeed()`.
176 Boost-style range facility and the `StringPiece` specialization.
180 Fast and compact reader-writer spin lock.
184 C++11 incarnation of the old [ScopeGuard](http://drdobbs.com/184403758) idiom.
188 A singleton to rule the singletons. This is an attempt to insert a layer between
189 C++ statics and the fiasco that ensues, so that things can be created, and destroyed,
190 correctly upon program creation, program end and sometimes `dlopen` and `fork`.
192 Singletons are bad for you, but this may help.
194 ####[`SmallLocks.h`](SmallLocks.md)
196 Very small spin locks (1 byte and 1 bit).
200 Vector with the small buffer optimization and an optional embedded
203 ####`sorted_vector_types.h`
205 Collections similar to `std::map` but implemented as sorted vectors.
209 A collection of efficient utilities for collecting statistics (often of
214 STL allocator wrapping a simple allocate/deallocate interface.
218 String utilities that connect `folly::fbstring` with `std::string`.
222 Subprocess library, modeled after Python's subprocess module.
224 ####[`Synchronized.h`](Synchronized.md)
226 High-level synchronization library.
230 Demangling and errno utilities.
232 ####[`ThreadCachedInt.h`](ThreadCachedInt.md)
234 High-performance atomic increment using thread caching.
236 ####[`ThreadLocal.h`](ThreadLocal.md)
238 Improved thread local storage for non-trivial types.
242 Queue with per-item timeout.
246 Type traits that complement those defined in the standard C++11 header
251 Defines the `codePointToUtf8` function.
255 A collection of utilities to deal with URIs.