forked from facebook/watchman
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use art to optimize pending list construction
Summary: In the recursive delete case we will receive notifications working up to the root of a tree from its leaves. Our existing pending list has very limited aggregation of events and will schedule a stat call for each deleted node. It is more efficient if we can lop off a portion of the tree when we add a recursive element at a higher location in the tree. That's what this diff does. It makes an invidual add operation a bit more expensive than it was previously, but the cost is tiny compared to the savings we get in terms of filesystem activity. The included benchmark demonstrates this with a synthetic tree containing around 260k nodes; these are added to a pending list first from the root to the leaves, and secondly from the leaves to the root. As part of this, we also generate a call to `w_lstat` to approximate the activity of our `stat_path` function. Prior to switching on the ART assisted index, both directions of insert would occupy approx. 2 seconds of wall time on my macbook. This represents the best case hot cache time for the `w_lstat` calls because the benchmark repeatedly examines the same file. With this diff we can prune the list of 260k nodes down to 12 nodes, and we will discover the pruned nodes as part of the recursive tree walk that will follow this in a real world situation. Test Plan: `make integration` (enabled -fsanitize=address to prove that our memory access is good, too). The benchmark results with this diff (previously, these would take 2 seconds each): ``` # took 0.011s to insert 12 items into pending coll # took 0.251s to reverse insert 12 items into pending coll ``` I also tried a pretty aggressive test where I would alternate between running: ``` hg sparse -X fooboid hg st watchman-diag | arc paste hg sparse --reset ``` (where fooboid is a large subdirectory of a large repo)
- Loading branch information
Showing
9 changed files
with
393 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.