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

vtables in C++ aren't free, but C++ has a couple of advantages here:

• If you're calling a nonvirtual method, you don't have to pay the vtable cost at all, just the cost of passing this. And most methods in C++ are nonvirtual.

• A call through a vtable is typically a couple of indexed fetches and an indirect jump. Objective-C's mechanism involves a hash-table lookup, which is a bit slower.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: