Skip to content

Conversation

@GarmashAlex
Copy link
Contributor

Motivation

Minor inefficiencies: unnecessary clone() in get_path() and allocations in Nibbles::skip_prefix()

Description

  • Replace self.child.clone().compute_hash() with self.child.compute_hash() in ExtensionNode::get_path() to avoid an unnecessary Arc clone. NodeRef::compute_hash(&self) already memoizes and requires no ownership.
  • Reimplement Nibbles::skip_prefix() using drain(..plen) to move the matched prefix into already_consumed without allocating a new Vec for the remaining tail. Semantics are preserved: data becomes the same tail and already_consumed gains the same bytes previously appended from prefix.data.

@GarmashAlex GarmashAlex requested a review from a team as a code owner November 3, 2025 06:24
@edg-l edg-l changed the title perf: Optimize Nibbles::skip_prefix to avoid tail allocation and remove redundant clone perf(l1): Optimize Nibbles::skip_prefix to avoid tail allocation and remove redundant clone Nov 3, 2025
@mpaulucci mpaulucci changed the title perf(l1): Optimize Nibbles::skip_prefix to avoid tail allocation and remove redundant clone perf(l1): optimize Nibbles::skip_prefix to avoid tail allocation and remove redundant clone Nov 3, 2025
@mpaulucci mpaulucci added the L1 Ethereum client label Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants