Skip to content

netlink: extract marshalMessages for independent testing and benchmarking - #310

Merged
nickgarlis merged 1 commit into
mdlayher:mainfrom
nickgarlis:extract-msg-serialization
Jul 19, 2026
Merged

nickgarlis merged 1 commit into
mdlayher:mainfrom
nickgarlis:extract-msg-serialization

Conversation

@nickgarlis

Copy link
Copy Markdown
Collaborator

SendMessages previously inlined the logic to serialize a slice of Messages into a single buffer. Extract this into a separate marshalMessages function with its own test and benchmark.

This is a first step toward investigating whether there are any benefits to optimizing the serialization path in SendMessages, as discussed in #254.

…king

SendMessages previously inlined the logic to serialize a slice of
Messages into a single buffer. Extract this into a separate
marshalMessages function with its own test and benchmark.

This is a first step toward investigating whether there are any
benefits to optimizing the serialization path in SendMessages, as
discussed in mdlayher#254.
@nickgarlis
nickgarlis requested review from SuperQ and mdlayher July 18, 2026 19:24
@SuperQ

SuperQ commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

The down side here is that we're going to make a copy of messages.

@nickgarlis

nickgarlis commented Jul 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

The down side here is that we're going to make a copy of messages.

You mean by passing down the slice of messages into marshalMessages ? That should only pass the slice by reference so there is no copying unless I am missing something.

@SuperQ SuperQ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't remember if the Go compiler is smart enough to optimize away the copy. Structurally this seems fine.

@nickgarlis
nickgarlis merged commit 373849e into mdlayher:main Jul 19, 2026
6 checks passed
nickgarlis added a commit to nickgarlis/netlink that referenced this pull request Sep 6, 2026
…king (mdlayher#310)

SendMessages previously inlined the logic to serialize a slice of
Messages into a single buffer. Extract this into a separate
marshalMessages function with its own test and benchmark.

This is a first step toward investigating whether there are any
benefits to optimizing the serialization path in SendMessages, as
discussed in mdlayher#254.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants