Fix ordering of debounced events#638
Merged
0xpr03 merged 2 commits intonotify-rs:mainfrom Sep 14, 2024
Merged
Conversation
Closed
maratik123
reviewed
Sep 14, 2024
notify-debouncer-full/src/lib.rs
Outdated
| let min_time = events_by_path | ||
| .values() | ||
| .map(|events| events[0].time) | ||
| .min() |
There was a problem hiding this comment.
Seem with that total algorithmic complexity has O(n^2). May be it is need to use binary heap or something like this to track min_time?
Member
Author
There was a problem hiding this comment.
Using BinaryHeap improves performance a bit. Especially in scenarios with many files.
I didn't commit the benchmark because I don't know if it's useful enough. But here are the results. Unfortunately they are a bit over the place, so I'm not sure how reliable they are:
sort-events/sort_events with 10 files and 100k events each
new: [328.05 ms 330.98 ms 334.31 ms]
old: [408.45 ms 453.59 ms 512.18 ms] +37.042%
sort-events/sort_events with 1k files and 1k events each
new: [398.06 ms 401.66 ms 405.87 ms]
old: [448.35 ms 454.64 ms 462.24 ms] +13.190%
sort-events/sort_events with 100k files and 10 events each
new: [841.49 ms 906.83 ms 1.0303 s]
old: aborted after 10 minutes
mo8it
approved these changes
Sep 14, 2024
rhizoome
added a commit
to rhizoome/gitbutler
that referenced
this pull request
Apr 9, 2025
ported from upstream fix notify-rs/notify#638
rhizoome
added a commit
to rhizoome/gitbutler
that referenced
this pull request
Apr 9, 2025
ported from upstream fix notify-rs/notify#638
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wasn't able to reproduce the panic, but the new sort logic should fix the issue and it's also stable now.
We should release this fix as soon as possible.
Fixes #636.