3 ms·
It's a measurable difference. OO in C++ must use double indirect vtable method calls, whilst this OO in C uses only one indirection. It's measurably faster. Obj
by rurban 5y ago
It's a measurable difference. OO in C++ must use double indirect vtable method calls, whilst this OO in C uses only one indirection. It's measurably faster. Objects are a bit larger though, cloning is a bit more expensive, but method calls are much faster and much easier to cache.
- aaaaaaaaaaab 5y agoI think you're misinterpreting GP's code. It is a vtable, hence the static const. There would be a pointer in each struct "instance" to this static vtable, thus the same double indirection would occcur as in C++.