Skip to content

inotify: avoid copying event buffers when reading names#741

Merged
mattn merged 1 commit into
fsnotify:mainfrom
mattn:inotify-event-name-fast-path
Apr 26, 2026
Merged

inotify: avoid copying event buffers when reading names#741
mattn merged 1 commit into
fsnotify:mainfrom
mattn:inotify-event-name-fast-path

Conversation

@mattn

@mattn mattn commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

This avoids copying the full inotify read buffer when extracting event names. Instead of copying the 64KB buffer and trimming trailing NUL bytes with strings.TrimRight, it now scans the name directly from the original buffer and trims the trailing NULs in place.

Before: 1151 ns/op
After: 31 ns/op

@mattn mattn requested a review from shogo82148 April 25, 2026 14:23

@shogo82148 shogo82148 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mattn mattn merged commit fdcafbf into fsnotify:main Apr 26, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants