Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reexamine use of virtual inheritance #1404

Open
sethrj opened this issue Sep 13, 2024 · 0 comments
Open

Reexamine use of virtual inheritance #1404

sethrj opened this issue Sep 13, 2024 · 0 comments
Labels
core Software engineering infrastructure

Comments

@sethrj
Copy link
Member

sethrj commented Sep 13, 2024

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 sethrj added the core Software engineering infrastructure label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Software engineering infrastructure
Projects
None yet
Development

No branches or pull requests

1 participant