4 ms·
GCC can use whole program optimization to replace virtual dispatch with a series of if statements. There are plenty of situations where it's faster to test for
by Kranar 5y ago
GCC can use whole program optimization to replace virtual dispatch with a series of if statements. There are plenty of situations where it's faster to test for a handful of types and then inline the body than it is to perform two indirections.
- hermitdev 5y ago> GCC can use whole program optimization to replace virtual dispatch with a series of if statements. Would you happen to have a sharable example of this occurring? I'd be curious to see what heuristics GCC is using. Also, what the conditional is on...is it still on the vtable, but just avoiding the indirect call?
- Kranar 5y agoJan Hubička worked on much of the devirtualization in GCC and posted a blog about how it works here: http://hubicka.blogspot.com/2014/01/devirtualization-in-c-part-1.html http://hubicka.blogspot.com/2014/01/devirtualization-in-c-pa...