-
Notifications
You must be signed in to change notification settings - Fork 574
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
ConfigItem::CommitNewItems(): allow fast search of pending items by type #9577
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Al2Klimov
force-pushed
the
ConfigItem-CommitNewItems
branch
from
November 9, 2022 16:06
5b4fef7
to
174d298
Compare
1 task
julianbrost
requested changes
Nov 17, 2022
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.
Change looks good overall. (I think there room for quite some more improvement in this function, but not in this PR.)
Al2Klimov
force-pushed
the
ConfigItem-CommitNewItems
branch
from
November 21, 2022 12:08
174d298
to
4edee35
Compare
julianbrost
requested changes
Nov 21, 2022
- cache result - return it by const ref - do Type::GetByName() for the callers
Al2Klimov
force-pushed
the
ConfigItem-CommitNewItems
branch
from
November 21, 2022 14:09
4edee35
to
ae693cb
Compare
julianbrost
approved these changes
Nov 23, 2022
Al2Klimov
added a commit
that referenced
this pull request
Feb 19, 2024
Before ae693cb (#9577) we've repeatedly looped over all items in parallel like this: while not types.done: for t in types: if not t.done and t.dependencies.done: with parallel(all_items, CONCURRENCY) as some_items: for i in some_items: if i.type is t: i.commit() I.e. all items got distributed over CONCURRENCY threads, but not always equally. E.g. it was the hosts' turn, but only two threads got hosts and did all the work. The others didn't do actual work (due to the lack of hosts in their queue) which reduced the performance. c721c30 (#6581) fixed it by shuffling all_items first. ae693cb (#9577) made the latter unnecessary by replacing the above algorithm with this: while not types.done: for t in types: if not t.done and t.dependencies.done: with parallel(all_items[t], CONCURRENCY) as some_items: for i in some_items: if i.type is t: i.commit() I.e. parallel() gets only items of type t, so all threads get e.g. hosts.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #9554