Skip to content

perf(nl): reuse itoa buffer for line numbering#10796

Closed
CrazyRoka wants to merge 1 commit intouutils:mainfrom
CrazyRoka:optimize-nl-buffer-creation
Closed

perf(nl): reuse itoa buffer for line numbering#10796
CrazyRoka wants to merge 1 commit intouutils:mainfrom
CrazyRoka:optimize-nl-buffer-creation

Conversation

@CrazyRoka
Copy link
Contributor

Avoid re-allocating an itoa::Buffer for every line processed. By lifting the buffer creation out of the format_to function, we reduce memory pressure and improve performance when processing large files.

@xtqqczze
Copy link
Contributor

xtqqczze commented Feb 7, 2026

The documentation for itoa::Buffer::new states: "This is a cheap operation; you don't need to worry about reusing buffers for efficiency."

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

GNU testsuite comparison:

GNU test failed: tests/pr/bounded-memory. tests/pr/bounded-memory is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)

@CrazyRoka
Copy link
Contributor Author

Right, I see no improvement

@CrazyRoka CrazyRoka closed this Feb 7, 2026
@CrazyRoka CrazyRoka deleted the optimize-nl-buffer-creation branch February 7, 2026 21:50
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