@david_chisnall @whitequark If I recall correctly that "is this class equal" is a pointer chase per base in the Itanium ABI, so 2 (T* -> vtbl[-1] -> ) +number of bases chases. And if you aren't on a system that dedupes .so symbols each of those might be an extra chase/strcmp of mangled names.

For MSVC if I recall correctly, it's 3 pointer chases (T* -> vtbl[-1] -> complete-object-locator -> base-class-array) to the base class array and a similar chase/strcmp.

Both strategies take like 3-4 times the time of something like llvm::dyn_cast<>. It is very possible to make a dynamic_cast implementation that does not suck for the common cases (by, for example, putting the list of types a thing is in the vtbl itself for the single inheritance cases to remove any extra pointer chases) but neither major ABI does that.