hdf5
hdf5 copied to clipboard
Add support for builtin_expect compiler hint
Do you have profiling that shows that this added complexity is worthwhile? I'm not opposed to adding it, but I don't want to add a bunch of /very/ compiler-specific complexity if this is just based on "thought experiment optimization".
Do you have profiling that shows that this added complexity is worthwhile? I'm not opposed to adding it, but I don't want to add a bunch of /very/ compiler-specific complexity if this is just based on "thought experiment optimization".
Here's a good stackoverflow that talks about the general improvements: https://stackoverflow.com/questions/109710/how-do-the-likely-unlikely-macros-in-the-linux-kernel-work-and-what-is-their-ben
And here's a more in-depth article that measures the effect, which looks to be a 15-20% performance improvement: http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html
I think that 15-20% is worth it for the FUNC_ENTER/LEAVE statements, which are almost never going to throw errors, and the concurrency routines, which are also very unlikely to throw errors and are also latency sensitive.