Skip to content

Avoid allocation in build_scriptint#1033

Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom
stevenroose:alloc-in-scriptint
Jun 3, 2022
Merged

Avoid allocation in build_scriptint#1033
apoelstra merged 1 commit intorust-bitcoin:masterfrom
stevenroose:alloc-in-scriptint

Conversation

@stevenroose
Copy link
Copy Markdown
Collaborator

@stevenroose stevenroose commented Jun 2, 2022

Hehe, reason for party, let's invite apoelstra !

@apoelstra
Copy link
Copy Markdown
Member

I like this approach -- but I think there's a more elegant way to do this, where write_scriptint takes an arbitrary W: Write, doesn't do its own length-tracking, and the caller gives it a Cursor<&mut [u8]> to get the length-tracking.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK c80dbc2

acking this version, as not to let the perfect be the enemy of the good. It's great to eliminate an allocation!

Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK c80dbc2

Comment on lines -1109 to +1117
use super::build_scriptint;
use super::write_scriptint;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can just delete these lines, wildcard import right above :) Probably not worth requiring re-acks just to do this though.

Copy link
Copy Markdown
Member

@sanket1729 sanket1729 left a comment

Choose a reason for hiding this comment

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

Code review ACK

@apoelstra apoelstra merged commit de17554 into rust-bitcoin:master Jun 3, 2022
ChallengeDev210 pushed a commit to ChallengeDev210/rust-bitcoin that referenced this pull request Aug 1, 2022
…tint

c80dbc2 Avoid allocation in build_scriptint (Steven Roose)

Pull request description:

  Hehe, reason for party, let's invite apoelstra !

ACKs for top commit:
  apoelstra:
    ACK c80dbc2
  tcharding:
    ACK c80dbc2

Tree-SHA512: 8446e765d8b9fa562f636817327db6fad4bb9c906d3f69fda76e61cd258fc4c296e6ffaa440a357125c2ab45603eb05c58cb8d6822deea2fe5746e5c7c3f1e4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants