3 ms·
I've done benchmarks on this fairly recently, and with the functions actually doing a lot of work (ray intersection for a raytracer), I saw practically no diffe
by berkut 13y ago
I've done benchmarks on this fairly recently, and with the functions actually doing a lot of work (ray intersection for a raytracer), I saw practically no difference between CRTP and Virtual Functions:
http://imagine-rt.blogspot.co.uk/2013/08/c-virtual-function-overhead.html http://imagine-rt.blogspot.co.uk/2013/08/c-virtual-function-...
And this was with billions of calls to the functions...
- blt 13y agoYes, the penalty is most glaring for calls that do a tiny amount of work. Imagine if String.charAt(int index) was a virtual call inside of strlen().