5 Below is a list of (some) Folly components in alphabetical order, along with
6 a brief description of each.
8 #### `Arena.h`, `ThreadCachedArena.h`
10 Simple arena for memory allocation: multiple allocations get freed all
11 at once. With threaded version.
13 #### [`AtomicHashMap.h`, `AtomicHashArray.h`](AtomicHashMap.md), `AtomicHashArray.h`, `AtomicLinkedList.h`, ...
15 High-performance atomic data-structures. Many of these are built with very specific
16 tradeoffs and constraints in mind that make them faster than their more general
17 counterparts. Each header should contain information about what these tradeoffs are.
21 A Baton allows a thread to block once and be awoken: it captures a single handoff. It is
22 essentially a (very small, very fast) semaphore that supports only a single call to `sem_call`
25 #### [`Benchmark.h`](Benchmark.md)
27 A small framework for benchmarking code. Client code registers
28 benchmarks, optionally with an argument that dictates the scale of the
29 benchmark (iterations, working set size etc). The framework runs
30 benchmarks (subject to a command-line flag) and produces formatted
31 output with timing information.
35 Various bit manipulation utilities optimized for speed; includes functions
37 [ffsl(l)](http://linux.die.net/man/3/ffsll) primitives in a uniform
40 #### `ConcurrentSkipList.h`
42 An implementation of the structure described in [A Provably Correct
43 Scalable Concurrent Skip
44 List](http://www.cs.tau.ac.il/~shanir/nir-pubs-web/Papers/OPODIS2006-BA.pdf)
47 #### [`Conv.h`](Conv.md)
49 A variety of data conversion routines (notably to and from string),
50 optimized for speed and safety.
54 Pretty-printing C++ types.
56 #### `DiscriminatedPtr.h`
58 Similar to `boost::variant`, but restricted to pointers only. Uses the
59 highest-order unused 16 bits in a pointer as discriminator. So
60 `sizeof(DiscriminatedPtr<int, string, Widget>) == sizeof(void*)`.
62 #### [`dynamic.h`](Dynamic.md)
64 Dynamically-typed object, created with JSON objects in mind. `DynamicConverter.h` is
65 a utility for effeciently converting from a `dynamic` to a more concrete structure when
66 the scheme is known (e.g. json -> `map<int,int>`).
68 #### `EvictingCacheMap.h`
70 A simple LRU hash map.
72 #### [`FBString.h`](FBString.md)
74 A drop-in implementation of `std::string` with a variety of optimizations.
76 #### [`FBVector.h`](FBVector.md)
78 A mostly drop-in implementation of `std::vector` with a variety of
83 A C++ abstraction around files.
89 ### [`Function.h`](Function.md)
91 A polymorphic wrapper for callables similar to `std::function` but not copyable and therefore able to wrap non-copyable callables, such as lambdas that capture move-only types like `std::unique_ptr` or `folly::Promise`.
93 ### [`futures/`](Futures.md)
95 Futures is a framework for expressing asynchronous code in C++ using the Promise/Future pattern.
97 #### [`Format.h`](Format.md)
99 Python-style formatting utilities.
103 This library makes it possible to write declarative comprehensions for
104 processing sequences of values efficiently in C++ akin to C#'s LINQ.
106 #### [`GroupVarint.h`](GroupVarint.md)
109 encoding](http://www.ir.uwaterloo.ca/book/addenda-06-index-compression.html)
114 A collection of utilities to deal with IPAddresses, including ipv4 and ipv6.
118 A collection of useful of abstractions for high-performance io. This is heavily relied upon
119 in Facebook's internally networking code.
123 Various popular hash function implementations.
125 #### [`Histogram.h`](Histogram.md)
127 A simple class for collecting histogram data.
129 #### `IntrusiveList.h`
131 Convenience type definitions for using `boost::intrusive_list`.
135 JSON serializer and deserializer. Uses `dynamic.h`.
139 Wrappers around [`__builtin_expect`](http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html).
141 #### `Malloc.h`, `Memory.h`
143 Memory allocation helpers, particularly when using jemalloc.
145 #### `MicroSpinLock.h`
147 A really, *really* small spinlock for fine-grained locking of lots of teeny-tiny data.
151 MPMCQueue<typename> is a high-performance bounded concurrent queue that
152 supports multiple producers, multiple consumers, and optional blocking.
153 The queue has a fixed capacity, for which all memory will be allocated
156 The additional utility `MPMCPipeline.h` is an extension that lets you
157 chain several queues together with processing steps in between.
159 #### [`PackedSyncPtr.h`](PackedSyncPtr.md)
161 A highly specialized data structure consisting of a pointer, a 1-bit
162 spin lock, and a 15-bit integral, all inside one 64-bit word.
164 #### [`Poly.h`](Poly.md)
166 A class template that makes it relatively easy to define a type-erasing
167 polymorphic object wrapper.
169 #### `Preprocessor.h`
171 Necessarily evil stuff.
173 #### [`ProducerConsumerQueue.h`](ProducerConsumerQueue.md)
175 Lock free single-reader, single-writer queue.
179 Defines only one function---`randomNumberSeed()`.
183 Boost-style range facility and the `StringPiece` specialization.
187 Fast and compact reader-writer spin lock.
191 C++11 incarnation of the old [ScopeGuard](http://drdobbs.com/184403758) idiom.
195 A singleton to rule the singletons. This is an attempt to insert a layer between
196 C++ statics and the fiasco that ensues, so that things can be created, and destroyed,
197 correctly upon program creation, program end and sometimes `dlopen` and `fork`.
199 Singletons are bad for you, but this may help.
201 #### [`SmallLocks.h`](SmallLocks.md)
203 Very small spin locks (1 byte and 1 bit).
205 #### `small_vector.h`
207 Vector with the small buffer optimization and an optional embedded
210 #### `sorted_vector_types.h`
212 Collections similar to `std::map` but implemented as sorted vectors.
216 A collection of efficient utilities for collecting statistics (often of
219 #### `StlAllocator.h`
221 STL allocator wrapping a simple allocate/deallocate interface.
225 String utilities that connect `folly::fbstring` with `std::string`.
229 Subprocess library, modeled after Python's subprocess module.
231 #### [`Synchronized.h`](Synchronized.md)
233 High-level synchronization library.
237 Demangling and errno utilities.
239 #### [`ThreadCachedInt.h`](ThreadCachedInt.md)
241 High-performance atomic increment using thread caching.
243 #### [`ThreadLocal.h`](ThreadLocal.md)
245 Improved thread local storage for non-trivial types.
247 #### `TimeoutQueue.h`
249 Queue with per-item timeout.
253 Type traits that complement those defined in the standard C++11 header
258 Defines the `codePointToUtf8` function.
262 A collection of utilities to deal with URIs.