Closed Bug 1204160 Opened 10 years ago Closed 5 years ago

Implement a small object optimization for mozilla::Function

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox43 --- affected

People

(Reporter: botond, Unassigned)

References

Details

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. [1] [1] https://github.com/llvm-mirror/libcxx/blob/6d9da5891f6628ffa9d2f382113a8231121aeee1/include/functional#L1564

Bug 1320752 removed mozilla::Function in favor of std::function, so this seems obsolete.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
See Also: → 1320752
You need to log in before you can comment on or make changes to this bug.