Skip to content

perf: Optimize debouncer.watch() lookup time#913

Merged
JohnTitor merged 3 commits intonotify-rs:mainfrom
dmtrKovalenko:fix/per-issues
May 2, 2026
Merged

perf: Optimize debouncer.watch() lookup time#913
JohnTitor merged 3 commits intonotify-rs:mainfrom
dmtrKovalenko:fix/per-issues

Conversation

@dmtrKovalenko
Copy link
Copy Markdown
Contributor

@dmtrKovalenko dmtrKovalenko commented Apr 30, 2026

Changelog

Optimize performance of debouncer.watch() calls

Testing

tested

Description

Use sorted VecDeque on 30k invocations cuts down all the linear scanning work that has be done before. Cuts down 10s to 300ms

Related Issues

closes #912

Use sorted VecDeque on 30k invocations cuts down all the linear scanning
work that has be done before. Cuts down 10s to 300ms
Comment on lines +593 to +594
.roots
.binary_search_by(|(p, _)| p.as_path().cmp(path.as_path()))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the path comparison is actually pretty slow in rust as well we could've compared underlying os_str but this will not work with non canonicalized paths

if we do that - performance impact would be absolutely unnoticable

Copy link
Copy Markdown
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

Thank you!

@JohnTitor JohnTitor merged commit 547f039 into notify-rs:main May 2, 2026
18 checks passed
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.

[Bug]: notify_debouncer_full .watch is very slow

2 participants