Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants