rpc: Faster getblock using PureBlock#17529
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
So I did some measurements: While this is a clear performance win, it seems the performance is dominated by shuffling the data around multiple times: Before: After: Hashing takes 10%-25% on intel CPUs. Didn't try arm. |
|
I guess it would be smarter to see if the rpc serialization flags are matching the ones of the block on disk and then just serve it raw. See #13151 |
If so, it would definitely be a simpler/smaller change! |
Those new types are currently unused. The underlying class has no transaction hash compiled in. So it is safe to use wherever it compiles. The existing CMutableTransaction retains the behavior to calculate the tx hash on demand. Use of CMutableTransaction makes compile-time complexity analysis impossible. The existing CTransaction retains the behavior to cache the hash on initialization.
|
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
|
Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened. |


This adds and uses a new transaction type
PureTransaction.The underlying class has no transaction hash compiled in. So
it is safe to use (and faster) wherever it compiles.
The existing CMutableTransaction retains the behavior to calculate the
tx hash on demand. Use of CMutableTransaction makes compile-time
complexity analysis impossible.
The existing CTransaction retains the behavior to cache the hash on
initialization.