News for hackers. Stuff that matters.
Re:Performance of Rust Language [pdf] by flohofwoe on Tuesday May 26, 2026 @03:01AM (#48276115)
> while in the C language structures with virtual function tables that are accessed explicitly by the programmer are in widespread use wherever suitable, for instance in many popular open-source C programs, like the Linux kernel or the debugger gdb

For dynamic dispatch there is absolutely no difference between using a jump table in C and virtual method tables in C++. If the compiler can infer the target address at compile time, it will not go through an indirect call, e.g.:

https://www.godbolt.org/z/as8ehGhv3

And for 'static dispatch' there's no difference between a C++ method call and a direct C function call (since for static dispatch the caller needs to 'know' the target function either way).

Re:Performance of Rust Language [pdf] by pjmlp on Tuesday May 26, 2026 @03:11PM (#48284461)
With the difference that in C++ you can easily generate such call table at compile time without macro soup, while having it type checked.

Even better if assuming C++26.