-
Notifications
You must be signed in to change notification settings - Fork 236
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
perf: cache system cell for resolve deps #2006
Conversation
073145a
to
e72ebc7
Compare
benchmark |
Benchmark Result
|
Please add PR description:
|
util/types/src/core/cell.rs
Outdated
@@ -424,16 +446,27 @@ pub fn resolve_transaction<CP: CellProvider, HC: HeaderChecker, S: BuildHasher>( | |||
} | |||
} | |||
|
|||
let system_cell = SYSTEM_CELL.get().expect("SYSTEM_CELL is not initialized"); |
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.
I think a more elegant solution is creating a wrapper around the resolver, like:
struct<F> CellProviderWithSystemCellCache {
system_cell: SystemCell,
inner: F,
}
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.
This PR is a draft for bench, I will improve it later.
But I think CellProvider
is also a bad idea, this cache is for dep, not input.
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.
Hold as requested by @zhangsoledad.
e72ebc7
to
0c86b9f
Compare
benchmark |
Benchmark Result
|
0c86b9f
to
4903071
Compare
Unhold as requested by @zhangsoledad.
bors r+ |
Build succeeded:
|
The goal of this PR is to optimize transaction resolve.
Currently, transaction resolve is inefficient, cause system-cell is uncached, every transaction depends on system cell will read system-cell from disk repeatedly. this PR proposal a system-cell cache implementation.