bazelbuild / sandboxfs

A virtual file system for sandboxing
Apache License 2.0
372 stars 39 forks source link

Delay format calls in error contexts #112

Closed jmmv closed 4 years ago

jmmv commented 4 years ago

It turns out that string formatting is quite expensive as part of mapping operations (surprise!) and we were doing some unnecessary calls to construct error messages that are never used. So, instead of using cause(), switch to using with_cause() so that we can delay the calls to format!() to when they are strictly needed.

Should cut about 15% of the CPU time spent within map operations per the measurements done by @beasleyr-vmw.

Fixes #111.