-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(trie): use Arc instead of references for nodes and state cursor factories #13868
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #13868 will not alter performanceComparing Summary
|
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 see a bunch of clones of non-Arc
values, I think it can get pretty expensive given that these cursor codepaths are hit often. To avoid that, we will need to further propagate the usage of Arc
s, right?
|
||
fn hashed_account_cursor(&self) -> Result<Self::AccountCursor, DatabaseError> { | ||
let cursor = self.cursor_factory.hashed_account_cursor()?; | ||
Ok(HashedPostStateAccountCursor::new(cursor, &self.post_state.accounts)) | ||
Ok(HashedPostStateAccountCursor::new(cursor, self.post_state.accounts.clone())) |
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.
also here, for example
yep, looking into it rn |
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.
given that all of these work with refs but we need an owned instance for the root task, I wonder if we can introduce owned factories which trait impls are then just delegate to .ref()
?
sounds great, will give it a try 🙌 |
f33988f
to
63b94ab
Compare
Extracted from #13749
The reference parameters in
InMemoryTrieCursorFactory
andHashedPostStateCursorFactory
cause lifetime problems when they are used to create and spawnStateRootTask
, this PR changes those parameters toArc
s.