-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Replace most uses of Map by HashMap #60999
Conversation
7c9ce88
to
523aa82
Compare
This is now ready for review. |
523aa82
to
773345f
Compare
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
773345f
to
746dddc
Compare
Amended to fix (manually..) the broken formatting caused by clang-format 14 in some headers. |
Did a quick sanity check as I had done for #60881. As mentioned there, it's not necessarily representative of what this PR impacts, it's just to make sure there's no huge obvious regression. The test is to start the editor on a 3D scene and then close it.
The difference seems small enough to merge this for now and unblock other PRs. There's likely still room for optimization and for doing proper benchmarks to see if/where there are bottlenecks. But generally speaking this PR mostly refactors the codebase to a better API so it can be merged as is, and the base HashMap / RBSet / RBMap implementations can be optimized further without changing the rest of the codebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to run fine on macOS, and I do not see any obvious slowdowns.
Note: There are a few questionable include changes (map
→ rb_map
while code was changed to use HashMap
).
We might want to do a cleanup pass for
|
Thanks! |
@reduz, this PR broke Edit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
OrderedHashMap -> HashMap Map -> HashMap See godot commit 8b7c7f5a753b43cec10f72b274bb1d70c253652b godotengine/godot#60999
There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
Bugsquad edit: Follow-up to #60881.