Skip to content
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

optimization: reserve memory allocation for transaction inputs/outputs #30093

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

l0rinc
Copy link
Contributor

@l0rinc l0rinc commented May 13, 2024

Reserved memory for the transaction inputs and outputs.

Split out of https://github.com/bitcoin/bitcoin/pull/30050/files#r1597631104

@DrahtBot
Copy link
Contributor

DrahtBot commented May 13, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK TheCharlatan
Concept ACK josibake
Stale ACK theuni

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24128 (wallet: BIP 326 sequence based anti-fee-snipe for taproot inputs by maflcko)

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.

@l0rinc l0rinc changed the title Optimize memory allocation for transaction outputs refactor: optimize memory allocation for transaction outputs May 13, 2024
@l0rinc l0rinc changed the title refactor: optimize memory allocation for transaction outputs refactor: reserve memory allocation for transaction outputs May 13, 2024
Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

src/wallet/spend.cpp Outdated Show resolved Hide resolved
@l0rinc l0rinc force-pushed the paplorinc/spend_preallocation branch from aaed2db to a1c3d58 Compare May 13, 2024 20:08
src/wallet/spend.cpp Outdated Show resolved Hide resolved
@josibake
Copy link
Member

Concept ACK

I noticed you have benchmarks, would be nice to have the comparison of old vs new in the PR description.

@l0rinc
Copy link
Contributor Author

l0rinc commented Jun 10, 2024

Thanks for the review @josibake, I've added the conclusions of the benchmarks to the commit message (but copied it to the PR description as well now), can you please check if ebf8667 answers your questions?

@theuni, appreciate your previous reviews and insights, please take a look at the changes I did since.

@theuni
Copy link
Member

theuni commented Jun 11, 2024

Changes look good. The bench is not really useful though, because it's testing things that aren't in our code.

I believe @josibake was asking for a bench that demonstrates a before/after of CreateTransactionInternal. I'm guessing that's not really feasible though, so I think it's enough to use your bench numbers without actually committing it.

@l0rinc l0rinc force-pushed the paplorinc/spend_preallocation branch from ebf8667 to a5b9175 Compare June 11, 2024 15:00
@l0rinc
Copy link
Contributor Author

l0rinc commented Jun 11, 2024

src/wallet/spend.cpp Outdated Show resolved Hide resolved
@l0rinc l0rinc force-pushed the paplorinc/spend_preallocation branch from a5b9175 to db2a31c Compare June 11, 2024 15:12
Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK db2a31c

@DrahtBot DrahtBot requested a review from josibake June 11, 2024 16:40
@l0rinc l0rinc changed the title refactor: reserve memory allocation for transaction outputs refactor: reserve memory allocation for transaction inputs/outputs Jun 13, 2024
@l0rinc l0rinc changed the title refactor: reserve memory allocation for transaction inputs/outputs Optimization: reserve memory allocation for transaction inputs/outputs Jun 23, 2024
@l0rinc l0rinc changed the title Optimization: reserve memory allocation for transaction inputs/outputs optimization: reserve memory allocation for transaction inputs/outputs Jun 23, 2024
@l0rinc l0rinc force-pushed the paplorinc/spend_preallocation branch from db2a31c to 634e266 Compare June 27, 2024 18:53
l0rinc and others added 2 commits June 27, 2024 20:56
Accommodating possible later insert as well

Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
Co-authored-by: Cory Fields <cory-nospam-@coryfields.com>
Copy link
Contributor

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ec585f1

@DrahtBot DrahtBot requested a review from theuni August 15, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants