Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does this really buy you that much? For most programs the runtime is going to be dominated by loop execution. If you're in a situation where the all the objects have the same type and the compiler could switch in static dispatch the computer's branch predictor should catch on very quickly and the performance gains won't be that high. In cases where you have heterogeneous objects the branch predictor won't be able to catch on but the compiler will be forced to stick with static dispatch anyways.

I suppose there is a bigger gain where you can inline static functions or optimize the calling convention.



Inlining is often called the mother of all optimizations. On its own, it doesn't gain you much compared to any other optimization, but once it's done it enables much, much more.

There's a reason languages like C that default to static dispatch on value types are so much faster without much effort.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: