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

AnnotationModel uses inefficient iteration over map, take 2 #980

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

iloveeclipse
Copy link
Member

@iloveeclipse iloveeclipse commented Aug 1, 2023

Synchronize on the map lock if possible and iterate via forEach() over the map.

This halves iteration time spent in cleanup() on huge annotation models.

Fixes #892

For test / use case that shows performance issue see this comment.

@iloveeclipse
Copy link
Member Author

@szarnekow : just in case you have time, please check this patch. I hope this addresses your (right) concerns on original attempt to fix the issue in eclipse-platform/eclipse.platform.text#22.

@iloveeclipse
Copy link
Member Author

Note, build failure is due #981.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

Test Results

     852 files  ±0       852 suites  ±0   1h 10m 26s ⏱️ - 1m 45s
  7 207 tests ±0    7 055 ✔️  - 1  149 💤 ±0  3 +1 
22 767 runs  ±0  22 277 ✔️  - 1  487 💤 ±0  3 +1 

For more details on these failures, see this check.

Results for commit b859a00. ± Comparison against base commit 1bd79e4.

♻️ This comment has been updated with latest results.

AnnotationModel.cleanup() will lock on the map while iterating over map
and iterate via forEach() instead to iterate over keys if possible.

This halves iteration time spent in cleanup() on huge annotation models.

Fixes eclipse-platform#892
@iloveeclipse
Copy link
Member Author

@szarnekow : please check last version.

@szarnekow
Copy link
Contributor

Change looks safe, and I think it's an improvement. How much of a difference do you see in your benchmarks?

@iloveeclipse
Copy link
Member Author

Something around 40% less time spent.

Copy link
Contributor

@szarnekow szarnekow left a comment

Choose a reason for hiding this comment

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

LGTM

@iloveeclipse iloveeclipse merged commit 1a1eb94 into eclipse-platform:master Aug 1, 2023
11 checks passed
@iloveeclipse iloveeclipse deleted the issue_892 branch August 1, 2023 13:34
@iloveeclipse
Copy link
Member Author

Thanks Sebastian! It is really nice to have someone asking right questions :-)

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.

AnnotationModel uses inefficient iteration over map
2 participants