Hacker News new | ask | show | jobs
by ComputerGuru 174 days ago
I guess I’m confused why an actual add instruction is emitted rather than whatever overloaded operation takes place when the + symbol (or overloaded add vtable entry) is called (like it would in other OOP languages).
2 comments

If all you're doing is summing small integers---frequently the case---it's much preferable to optimize that to be fast and then skip the very dynamic method lookup (the slower, less common case)
Presumably other languages with JIT do exactly the same thing?