Skip to content

perf: Copy less when serializing Bind messages - #3740

Merged
brianc merged 3 commits into
brianc:masterfrom
charmander:bind-message-copy-less
Aug 12, 2026
Merged

perf: Copy less when serializing Bind messages#3740
brianc merged 3 commits into
brianc:masterfrom
charmander:bind-message-copy-less

Conversation

@charmander

@charmander charmander commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Takes about 15–30% less time on some parameter values in my measurements. Performance here could still be improved by a lot, but many other improvements also need interface changes, so I separated out this patch that was fully backwards-compatible.

This comment was marked as resolved.

…er` shrinks values

It would have created an incomplete message anyway, but I figured this was vaguely plausible, bad enough, and easy enough to fix. No test though, because the test is annoying to write.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@charmander
charmander requested a review from brianc August 11, 2026 05:35

@brianc brianc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

dang, nice!

const writeValues = function (values: any[], valueMapper?: ValueMapper): void {
for (let i = 0; i < values.length; i++) {
const writeValues = function (values: any[], valueMapper: ValueMapper | undefined, formatsOffset: number): void {
const len = values.length

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

surprising this is still a perf improvement in 2026!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I’m not sure whether there’s a performance effect, but it was mainly for #3740 (comment).

@brianc
brianc merged commit 816d073 into brianc:master Aug 12, 2026
12 checks passed
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