16 Jan
2018
16 Jan
'18
1:54 p.m.
Andrey Semashev wrote:
In the generated code I noticed that the compiler generated a check of whether the virtual function `failure` is actually `experimental::error_category::failure`. If it is, the code uses an inlined version of this function (otherwise, the actual indirect call is performed). So if you comment `code_category_impl::failure` the test succeeds and the indirect call is avoided. Here are the results for this case:
Experimental test: 71711 usec, 1394486201.559036 tests per second std test: 48177 usec, 2075679266.039812 tests per second
This is still a 1.5x difference.
That's pretty good. In practice, if the function does something nontrivial, this amount of overhead will be entirely lost in the noise.