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

[NFC] Use unordered_map for better performance #2356

Merged
merged 4 commits into from
Mar 4, 2024

Conversation

LU-JOHN
Copy link
Contributor

@LU-JOHN LU-JOHN commented Feb 12, 2024

Use unordered_map instead of map for better performance.

@MrSidims
Copy link
Contributor

I'm expecting, that lots of test would need to be updated, as order of IDs wouldn't remain after it. We would also need to check, if new order of IDs makes sense.
Please also note, that while map to hash table replacement seems legit for {int, int} or {ptr, ptr} pairs, it's less obvious, that it will bring performance benefits for {string, int} pairs.

PS DebugInfo failures are related to #2357 . You may want to incorporate #2362 for testing

Signed-off-by: Lu, John <john.lu@intel.com>
Signed-off-by: Lu, John <john.lu@intel.com>
Signed-off-by: Lu, John <john.lu@intel.com>
Signed-off-by: Lu, John <john.lu@intel.com>
@LU-JOHN LU-JOHN force-pushed the prefer_unordered_map branch 2 times, most recently from abeda5b to 89cb624 Compare February 14, 2024 15:25
@LU-JOHN
Copy link
Contributor Author

LU-JOHN commented Feb 14, 2024

I'm expecting, that lots of test would need to be updated, as order of IDs wouldn't remain after it. We would also need to check, if new order of IDs makes sense. Please also note, that while map to hash table replacement seems legit for {int, int} or {ptr, ptr} pairs, it's less obvious, that it will bring performance benefits for {string, int} pairs.

PS DebugInfo failures are related to #2357 . You may want to incorporate #2362 for testing

I've incorporated #2362. I think I've avoided changing maps that will affect the output order.

@LU-JOHN
Copy link
Contributor Author

LU-JOHN commented Feb 26, 2024

Please take a look @asudarsa @bwlodarcz @MrSidims

Copy link
Contributor

@MrSidims MrSidims left a comment

Choose a reason for hiding this comment

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

Tentatively approving, but would be nice to have some numbers for performance improvements.
While in most cases it's LGTM, yet it's less obvious, that it improves std::string key cases.

@bwlodarcz
Copy link
Contributor

@MrSidims It's valid improvement on algorithmic level but won't be visible in performance metrics due that other things (getEntry chain) are dominating execution time. Still, the gain is here.

@MrSidims MrSidims merged commit 5653803 into KhronosGroup:main Mar 4, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants