4 ms·
The only reason vtables et all work as well as they do is modern branch predictors are incredible.
by jasonwatkinspdx 5y ago
The only reason vtables et all work as well as they do is modern branch predictors are incredible.
- dzaima 5y agoWell, the alternative to vtables is manually branching (besides completely rewriting the code to avoid different actions), which isn't that much better and still requires branch prediction. And I think JVMs also might convert a dispatch from two classes to a conditional branch, but I'm not sure.
- nayuki 5y agoYes: https://shipilev.net/blog/2015/black-magic-method-dispatch/#_three_types_and_beyond https://shipilev.net/blog/2015/black-magic-method-dispatch/#...