So you've gone from a 10-line function to 120-lines for two functions. Is there a point at which the extra complexity and code size is considered not worth it?
I think only when you think this kind of calculation is actually the hotspot of your code, and you should put a lot of effort to optimize it, then you could consider to do such things.
It is not something about complexity and code size, it is about the performance optimization.
I used to optimize a C++ application with SIMD intrinsics. The most time consuming function of this app is a linear algebra algorithm. That could perfectly fit this kind of optimization.
However, writing this kind of code and debug it took me a lot of time. I would say for most of "normal" application, it is useless.
In this case the code being optimised is in the framework, so it may be in the hotspot of some programs, but most aren't. The decision being made here is that faster is always better, but I wonder if that's the case. Is that 100 (say) instructions going to push other code or data out of L1?
6 comments
[ 2.8 ms ] story [ 23.4 ms ] threadIt is not something about complexity and code size, it is about the performance optimization.
I used to optimize a C++ application with SIMD intrinsics. The most time consuming function of this app is a linear algebra algorithm. That could perfectly fit this kind of optimization.
However, writing this kind of code and debug it took me a lot of time. I would say for most of "normal" application, it is useless.