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

Rlp.Encode skip second array creation for length #8440

Merged
merged 2 commits into from
Mar 31, 2025
Merged

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Mar 29, 2025

Changes

This PR optimizes RLP encoding by reducing unnecessary array allocations and improving memory usage. Key changes include:

  • Eliminating a second array creation when serializing lengths.
  • Refactoring the SerializeLength method to use spans and uninitialized arrays.
  • Introducing the [SkipLocalsInit] attribute on key methods for potential performance benefits.

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No - existing tests

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes RLP encoding by reducing unnecessary array allocations and improving memory usage. Key changes include:

  • Eliminating a second array creation when serializing lengths.
  • Refactoring the SerializeLength method to use spans and uninitialized arrays.
  • Introducing the [SkipLocalsInit] attribute on key methods for potential performance benefits.

@benaadams
Copy link
Member Author

Pull Request Overview

This PR optimizes RLP encoding by reducing unnecessary array allocations and improving memory usage. Key changes include:

  • Eliminating a second array creation when serializing lengths.
  • Refactoring the SerializeLength method to use spans and uninitialized arrays.
  • Introducing the [SkipLocalsInit] attribute on key methods for potential performance benefits.

Gonna take this review summary as summary @rubo 😅

@benaadams benaadams merged commit 7461ca0 into master Mar 31, 2025
80 checks passed
@benaadams benaadams deleted the rlp-encode branch March 31, 2025 20:57
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.

3 participants