@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.
In reply to
Billy O'Neal
@malwareminigun@infosec.exchange
Dev at Microsoft on the vcpkg team. Former @VisualC STL maintainer. He/Him (Although I don’t care much)
infosec.exchange
Billy O'Neal
@malwareminigun@infosec.exchange
Dev at Microsoft on the vcpkg team. Former @VisualC STL maintainer. He/Him (Although I don’t care much)
infosec.exchange
@malwareminigun@infosec.exchange
·
5d ago
2
2
0
Conversation (2)
Showing 0 of 2 cached locally.
Syncing comments from the remote thread. 2 more replies are still loading.
Loading comments...