Skip to content

perf: optimize FormatNsenterInfo string building#583

Open
hemang1404 wants to merge 1 commit intourunc-dev:mainfrom
hemang1404:fix-add-initrd-record
Open

perf: optimize FormatNsenterInfo string building#583
hemang1404 wants to merge 1 commit intourunc-dev:mainfrom
hemang1404:fix-add-initrd-record

Conversation

@hemang1404
Copy link
Copy Markdown
Contributor

Description

This PR optimizes the namespace info formatting process by replacing strings.Builder with bytes.Buffer in FormatNsenterInfo. This eliminates an unnecessary intermediate allocation and copy step when converting the string to a byte slice, saving 2 allocations per operation.

Related issues

How was this tested?

  • Validated that go build ./... passes to ensure type compatibility with the bytemsg struct.
  • Validated that 'make unittest' passes

LLM usage

N/A

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

This commit replaces strings.Builder with bytes.Buffer to prevent an
unnecessary intermediate string to byte slice allocation.

Fixes: urunc-dev#501
Signed-off-by: hemang1404 <hemangsharrma@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 28, 2026

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 1f50577
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/69f123b4a81aa7000830e78d

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.

Optimize FormatNsenterInfo string building

1 participant