Skip to content

Conversation

@strmfos
Copy link
Contributor

@strmfos strmfos commented Oct 28, 2025

While looking at the derive macro code, I noticed we're converting syn::Ident to String just to compare it with string literals in should_use_alt_impl(). This creates unnecessary heap allocations during macro expansion.

Since syn::Ident already implements PartialEq<&str>, we can compare directly without the .to_string().as_str() chain. This matches the pattern already used on line 155 in the same file for the "maybe_zero" check.

The change is semantically identical but skips the temporary String allocation on every type check, which should help compile times for projects with lots of Compact derives.

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.

this makes sense

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Oct 29, 2025
@mattsse mattsse added this pull request to the merge queue Oct 29, 2025
Merged via the queue into paradigmxyz:main with commit b15c285 Oct 29, 2025
41 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants