Skip to content

Optimize and clean up HashSet::clear#108698

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
Brogolem35:hashset_clear_optimize
Sep 30, 2025
Merged

Optimize and clean up HashSet::clear#108698
Repiteo merged 1 commit into
godotengine:masterfrom
Brogolem35:hashset_clear_optimize

Conversation

@Brogolem35
Copy link
Copy Markdown
Contributor

This PR makes a minor cleanup on HashSet::clear().

Thing done:
Use memset instead of a for loop to clear the hashes array.
Check if destructor should be called on keys on compile time to avoid unnecessary iteration.

@Brogolem35 Brogolem35 requested a review from a team as a code owner July 17, 2025 07:48
@Ivorforce Ivorforce added this to the 4.6 milestone Jul 17, 2025
Copy link
Copy Markdown
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.

This is a simple enough improvement, and should slightly help performance.

The for loop will likely be optimized away anyway, but we have it wrapped in if constexpr in other places anyway just to be sure about it.

To release managers: Please note that we have #107045 open which also touches this code. I would prefer for #107045 to be merged first.

@AThousandShips AThousandShips changed the title Optimize and cleanup HashSet::clear Optimize and clean up HashSet::clear Jul 28, 2025
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Sep 20, 2025

Could you rebase the PR and squash your commits? See our pull request guidelines for more information

@Brogolem35 Brogolem35 force-pushed the hashset_clear_optimize branch from 56385ad to 7685cb6 Compare September 21, 2025 07:21
@Brogolem35
Copy link
Copy Markdown
Contributor Author

Could you rebase the PR and squash your commits? See our pull request guidelines for more information

I resolved conflict and squashed the history.

@Repiteo Repiteo merged commit 4d13966 into godotengine:master Sep 30, 2025
39 of 40 checks passed
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented Sep 30, 2025

Thanks! Congratulations on your first merged contribution! 🎉

@akien-mga akien-mga changed the title Optimize and clean up HashSet::clear Optimize and clean up HashSet::clear Jan 25, 2026
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.

4 participants