celeritas icon indicating copy to clipboard operation
celeritas copied to clipboard

Reexamine use of virtual inheritance

Open sethrj opened this issue 1 year ago • 0 comments

Virtual+multiple inheritance certainly works as a design pattern but it has some pretty large overhead both in code and object size. Even empty classes (default destructors, no data) require extra construction vtables. Adding mutable/base interfaces for the action classes increases action class setup/teardown/vtable/typeinfo code size about 30% in the simplest case, most of it in initialization. Eliminating virtual inheritance reduces the code size by another 40% after that.

We need to at least make sure that we only use virtual inheritance with hierarchies as shallow as possible, for as few as possible classes, and only using those at a high level.

sethrj avatar Sep 13 '24 20:09 sethrj