Make cancelling and rescheduling of functions O(1) v2017.08.28.00
authorPatryk Zaryjewski <patzar@fb.com>
Mon, 28 Aug 2017 06:35:38 +0000 (23:35 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Mon, 28 Aug 2017 07:00:42 +0000 (00:00 -0700)
commit951a822cd2b05291669256d54d1c623deb3a9673
tree6f24ad6c5bc4f34c13646f0f9eab5add5d61a7e1
parentdb9fd491eacdbef14aba095dd9ffd1b7e51e2689
Make cancelling and rescheduling of functions O(1)

Summary: Currently FunctionScheduler calls that cancel/restart timer for a function of particular id are O(n). By introducing hashmap that translate id to pointer of particular RepeatFunc, we make it O(1).

Reviewed By: simpkins

Differential Revision: D5668557

fbshipit-source-id: e5e8bf9bd75b6d5d42f0bfa398d476703e5801fa
folly/experimental/FunctionScheduler.cpp
folly/experimental/FunctionScheduler.h