-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
More optimizations to package load #14762
Merged
+50
−23
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ pub struct TemporaryStore<'backing> { | |
|
||
/// Every package that was loaded from DB store during execution. | ||
/// These packages were not previously loaded into the temporary store. | ||
runtime_packages_loaded_from_db: RwLock<BTreeMap<ObjectID, Object>>, | ||
runtime_packages_loaded_from_db: RwLock<BTreeMap<ObjectID, PackageObjectArc>>, | ||
} | ||
|
||
impl<'backing> TemporaryStore<'backing> { | ||
|
@@ -1003,10 +1003,17 @@ impl<'backing> BackingPackageStore for TemporaryStore<'backing> { | |
self.store.get_package_object(package_id).map(|obj| { | ||
// Track object but leave unchanged | ||
if let Some(v) = &obj { | ||
// TODO: Can this lock ever block execution? | ||
self.runtime_packages_loaded_from_db | ||
.write() | ||
.insert(*package_id, v.object().clone()); | ||
if !self | ||
.runtime_packages_loaded_from_db | ||
.read() | ||
.contains_key(package_id) | ||
{ | ||
// TODO: Can this lock ever block execution? | ||
// TODO: Why do we need a RwLock anyway??? | ||
self.runtime_packages_loaded_from_db | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This lock is for interior mutability since we only take self as read ref |
||
.write() | ||
.insert(*package_id, v.clone()); | ||
} | ||
} | ||
obj | ||
}) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ pub struct TemporaryStore<'backing> { | |
|
||
/// Every package that was loaded from DB store during execution. | ||
/// These packages were not previously loaded into the temporary store. | ||
runtime_packages_loaded_from_db: RwLock<BTreeMap<ObjectID, Object>>, | ||
runtime_packages_loaded_from_db: RwLock<BTreeMap<ObjectID, PackageObjectArc>>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should consider just switching to DashMap |
||
|
||
/// The set of objects that we may receive during execution. Not guaranteed to receive all, or | ||
/// any of the objects referenced in this set. | ||
|
@@ -1113,10 +1113,17 @@ impl<'backing> BackingPackageStore for TemporaryStore<'backing> { | |
self.store.get_package_object(package_id).map(|obj| { | ||
// Track object but leave unchanged | ||
if let Some(v) = &obj { | ||
// TODO: Can this lock ever block execution? | ||
self.runtime_packages_loaded_from_db | ||
.write() | ||
.insert(*package_id, v.object().clone()); | ||
if !self | ||
.runtime_packages_loaded_from_db | ||
.read() | ||
.contains_key(package_id) | ||
{ | ||
// TODO: Can this lock ever block execution? | ||
// TODO: Why do we need a RwLock anyway??? | ||
self.runtime_packages_loaded_from_db | ||
.write() | ||
.insert(*package_id, v.clone()); | ||
} | ||
} | ||
obj | ||
}) | ||
|
Oops, something went wrong.
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.
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.
ditto DashMap