Make Fault Injection sites cheaper, when no faults have been activated.
Fault injection is expected to be *very* cheap, we even enable it on production builds. That's why I was very surprised when I saw 'perf' report that FaultInjector_InjectFaultIfSet() was consuming about 10% of CPU time in a performance test I was running on my laptop. I tracked it to the FaultInjector_InjectFaultIfSet() call in standard_ExecutorRun(). It gets called for every tuple between 10000 and 1000000, on every segment. Why is FaultInjector_InjectFaultIfSet() so expensive? It has a quick exit in it, when no faults have been activated, but before reaching the quick exit it calls strlen() on the arguments. That's not cheap. And the function call isn't completely negligible on hot code paths, either. To fix, turn FaultInjector_InjectFaultIfSet() into a macro that's only few instructions long in the fast path. That should be cheap enough. Reviewed-by: NAshwin Agrawal <aashwin@vmware.com> Reviewed-by: NJesse Zhang <jzhang@pivotal.io> Reviewed-by: NAsim R P <pasim@vmware.com>
Showing
想要评论请 注册 或 登录