Make RequestContext provider overridable in order to save cost of setContext() on...
authorJon Maltiel Swenson <jmswen@fb.com>
Tue, 12 Sep 2017 16:09:42 +0000 (09:09 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 12 Sep 2017 16:27:43 +0000 (09:27 -0700)
commit943afd983a0bce0f1962717a70aa7ab2d3e49a68
tree842dc92fb93922e1654923a6b6865ee5a716d7a3
parent14b0638329890bc8ac0bcd517d191e8517d58e76
Make RequestContext provider overridable in order to save cost of setContext() on each fiber context switch

Summary:
Each fiber context switch currently involves the cost of saving/restoring `RequestContext`.  Certain
fibers-based applications such as mcrouter don't use `RequestContext` at all, so updating the current
thread-global `RequestContext` on each fiber context switch is unnecessary overhead.  Avoid this cost
by allowing `FiberManager` to override the `RequestContext` provider at the start and end of each fiber drain
loop.

Reviewed By: andriigrynenko

Differential Revision: D5787837

fbshipit-source-id: ea9041ce228063c8701165366fd1e34132868d22
folly/fibers/FiberManagerInternal-inl.h
folly/fibers/test/FibersTest.cpp
folly/io/async/Request.cpp
folly/io/async/Request.h
folly/io/async/test/RequestContextTest.cpp