Open Bug 1204160 Opened 4 years ago Updated 4 years ago
Implement a small object optimization for mozilla::Function
Currently, mozilla::Function stores a UniquePtr to the object that stores the wrapped callable. This means every instance of mozilla::Function incurs a dynamic allocation. We should consider implementing a small-object optimization, where if the size of the callable is smaller than a threshold (say, 16 bytes), the callable is stored in-line. libc++'s implementation of std::function does this.   https://github.com/llvm-mirror/libcxx/blob/6d9da5891f6628ffa9d2f382113a8231121aeee1/include/functional#L1564
You need to log in before you can comment on or make changes to this bug.