improve perf of Core::hasResult()
Summary: Core::hasResult() is called in lots of places: - future.result() - future.get() - future.wait() - future.within() - future.hasValue() - future.hasException() - future.getTry() - future.raise() - future.poll() - promise.setInterruptHandler() - etc. This diff improves that function as follows (source: godbolt, with optimization, on both gcc and clang): - old: 7 instructions w/ 2 conditional jumps + 1 unconditional jump; fastest path is 4 instructions w/ 2 jumps, slowest is 7 instructions w/ 2 jumps - new: 3 instructions w/ 0 jumps Small improvement overall, but to a widely used function. Reviewed By: yfeldblum Differential Revision: D8231048 fbshipit-source-id: 83a9f5c602475c2ca7066a45635d807596ecf37d
Showing
Please register or sign in to comment