Skip to content

perf: skip construction for unchanged stuff#905

Open
JohnTitor wants to merge 1 commit intonotify-rs:mainfrom
JohnTitor:poll-tweak
Open

perf: skip construction for unchanged stuff#905
JohnTitor wants to merge 1 commit intonotify-rs:mainfrom
JohnTitor:poll-tweak

Conversation

@JohnTitor
Copy link
Copy Markdown
Member

Description

Optimize PollWatcher rescans by deferring reported-path construction until an event is actually emitted.
The rescan loop now compares the existing and new PathData first, updates stored data in place for existing paths, and only builds the reported Event path when compare_to_kind returns an actual event kind.

On my end, it's roughly a 25% improvement for the measured no-op recursive polling workload.

Related Issues

Comment thread notify/src/poll.rs
event_kind
} else {
let event_kind = PathData::compare_to_kind(None, Some(&new_path_data));
self.all_path_data.insert(path.clone(), new_path_data);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The main win comes from not calling this clone unconditionally.

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.

1 participant