(Wangle) Allocate lambda space inside Core instead of inside std::function
authorHannes Roth <hannesr@fb.com>
Wed, 1 Apr 2015 21:35:55 +0000 (14:35 -0700)
committerafrind <afrind@fb.com>
Thu, 2 Apr 2015 19:02:10 +0000 (12:02 -0700)
commit714633903be94edc55af06571738d3ad0343b925
treeea9e4ea3a4f2a955be56c29421a9521d420db1fd
parentb2901a613fe98276fcbf265ed22f7fe8282cf673
(Wangle) Allocate lambda space inside Core instead of inside std::function

Summary:
Taking this trick that is used in the fibers library. We can keep 64
bytes of space inside `Core` to allocate the callback lambda into,
instead of having `std::function` do another `malloc`. This seems to
greatly improve the synthethic benchmark, and hopefully production
workloads, too, by reducing the number of mallocs.

64 bytes were picked because it fits all the lambdas in the futures
tests. We might want to adjust this based on production data...?

https://fb.intern.facebook.com/groups/715931878455430/permalink/837898842925399/

Test Plan: Run all the tests for all platforms, compilers, and Windtunnel.

Reviewed By: hans@fb.com

Subscribers: chalfant, meisner, folly-diffs@, jsedgwick, yfeldblum

FB internal diff: D1931620

Signature: t1:1931620:1427841595:6ec667b58980be232dfb116bc316148bb67de4fc
folly/futures/detail/Core.h
folly/futures/test/FutureTest.cpp