Skip to content

Core: Remove class_db.h include from ref_counted.h#116737

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
Repiteo:core/ref-tidy-include
Feb 27, 2026
Merged

Core: Remove class_db.h include from ref_counted.h#116737
Repiteo merged 1 commit intogodotengine:masterfrom
Repiteo:core/ref-tidy-include

Conversation

@Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Feb 24, 2026

Changes:

  • Ref templates for PtrToArg, GetTypeInfo, and VariantInternalAccessor were migrated to the original headers, as there's no longer a risk of circular includes.
  • Headers with functions operating on ClassDB directly had their logic migrated to implementation files.

I know there's been hesitation in the past about tackling the removal of class_db.h includes1, but I think the changes here demonstrate that this warrants revisiting. Even after migrating ClassDB logic to implementation files, many headers & implementation files alike still needed additional includes. This is because several of the affected files weren't for Object subclasses at all; plenty of utilities were including class_db.h indirectly!

This isn't even mentioning the current cost of these includes. class_db.h and ref_counted.h both rank in the top 5 of fresh compile and recompile times. While Object and Variant are likely the two "real" compile-time culprits, Ref wasn't helping matters with a direct include of ClassDB. So while it'll likely still rank fairly high, it's feasible that this change alone could dethrone ref_counted.h as the single most expensive file from a fresh compilation.

Footnotes

  1. https://github.com/godotengine/godot/pull/111573#pullrequestreview-3330940683

@Repiteo Repiteo added this to the 4.x milestone Feb 24, 2026
@Repiteo Repiteo requested a review from a team as a code owner February 24, 2026 21:45
@Repiteo Repiteo requested review from a team as code owners February 24, 2026 21:45
@Repiteo Repiteo removed request for a team February 24, 2026 21:46
@Repiteo Repiteo force-pushed the core/ref-tidy-include branch from a14190b to abdde1b Compare February 27, 2026 00:14
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Repiteo Repiteo modified the milestones: 4.x, 4.7 Feb 27, 2026
@Repiteo Repiteo merged commit 6cccb37 into godotengine:master Feb 27, 2026
20 checks passed
@Repiteo Repiteo deleted the core/ref-tidy-include branch February 27, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants