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

perf(utils): avoid unnecessary allocations #2046

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

DaniPopes
Copy link
Collaborator

@DaniPopes DaniPopes commented Jan 11, 2023

Motivation

Into<Bytes> allocates to the heap in get_create2_address[_from_hash]

Solution

Use AsRef<[u8]>, minor breaking change only if the type was manually specified wrapper struct / function

Push/Extend a Vec<u8> instead of [...].concat() / format!("...")

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog
  • Breaking changes

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

ty, lgtm

suggesting re H160 v Address.

this isn't actually breaking, right?

ethers-core/src/utils/mod.rs Outdated Show resolved Hide resolved
ethers-core/src/utils/mod.rs Show resolved Hide resolved
@gakonst gakonst merged commit b4b153a into gakonst:master Jan 12, 2023
@DaniPopes DaniPopes deleted the perf/utils branch January 27, 2023 17:00
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.

None yet

3 participants