3 ms·
I guess virtual functions are common in some places. This thing seems to generate code to check if the type matches what was inlined, and do the ordinary virtu
by ncmncm 4y ago
I guess virtual functions are common in some places.
This thing seems to generate code to check if the type matches what was inlined, and do the ordinary virtual call if it doesn't match. Virtual-call branches are well predicted nowadays, but the opportunity to integrate the code before and after the call might be worth something, probably by deleting code that computes something thrown away in that case.
- mgraczyk 4y agoEven if virtual call branches are well predicted, they still have high overhead. Yeah GCC and clang will do what you described in some cases, they will insert a check and try to make a non-virtual call when possible. But also as you mentioned, they real advantage is from the downstream optimizations that unlocks, which they cannot do.