X Tutup
Skip to content

Only include hash_set.h and safe_refcount.h in object.h when used.#111371

Open
chocola-mint wants to merge 1 commit intogodotengine:masterfrom
chocola-mint:object-conditional-includes
Open

Only include hash_set.h and safe_refcount.h in object.h when used.#111371
chocola-mint wants to merge 1 commit intogodotengine:masterfrom
chocola-mint:object-conditional-includes

Conversation

@chocola-mint
Copy link
Contributor

Addresses #111218

hash_set.h and safe_refcount.h are only used in editor builds and debug builds respectively. This PR makes it so their headers aren't unnecessarily included and should improve compilation times for release builds.

@chocola-mint chocola-mint requested a review from a team as a code owner October 7, 2025 16:28
@AThousandShips
Copy link
Member

This would need to be tested with a few different compile configurations to avoid cases like:

@chocola-mint chocola-mint force-pushed the object-conditional-includes branch from 205ddde to 6582b1f Compare October 8, 2025 11:37
@akien-mga
Copy link
Member

This makes sense in principle, but I think it might end up being a source of frustration for contributors. Most contributors build the editor (both TOOLS_ENABLED and DEBUG_ENABLED), which means they'll have these includes in pretty much all the codebase through object.h, and won't need to add them explicitly in classes that need them. Then when they send their PR, the CI will fail in surprising ways.

I don't think slightly reducing the incremental recompilation time of templates is worth that development time hassle.

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.

3 participants

X Tutup