Skip to content

perf(json-rpc): preallocate capacity in ResponsePacket deserialization#3929

Open
DivooOliver wants to merge 1 commit intoalloy-rs:mainfrom
DivooOliver:jsonRpc
Open

perf(json-rpc): preallocate capacity in ResponsePacket deserialization#3929
DivooOliver wants to merge 1 commit intoalloy-rs:mainfrom
DivooOliver:jsonRpc

Conversation

@DivooOliver
Copy link
Copy Markdown
Contributor

Use Vec::with_capacity(seq.size_hint().unwrap_or(0)) instead of Vec::new() when deserializing batch responses. For large batches (100+ responses), this avoids 6-7 reallocation cycles during the while-push loop.

Use `Vec::with_capacity(seq.size_hint().unwrap_or(0))` instead of `Vec::new()` when deserializing batch responses. For large batches (100+ responses), this avoids 6-7 reallocation cycles during the while-push loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant