3 ms·
When you call/jump through a vtable, you've already lost inlining opportunities. Indirect branches themselves aren't free either. This is an order of magnitude
by vardump 11y ago
When you call/jump through a vtable, you've already lost inlining opportunities. Indirect branches themselves aren't free either. This is an order of magnitude performance loss for simple functions. Additional order of magnitude worse, if the simple function behind vtable indirect jump/call was a vectorization opportunity.
- vidarh 11y agoAgreed, which is why I also pointed out that with suitable guards and fallback path you can often inline as well, as large proportions of callsites in dynamic code is monomorphic or can be transformed to monomorphic by relatively small numbers of guards and split paths that can often be hoisted quite far. But a call/jump via vtable is already a massive improvement over most dynamic language implementations. It's not unusual still to find e.g. hash-table lookups and hierarchical searches up through the inheritance chain for no good reason.