Skip to content

Commit

Permalink
merged_tree: add Stream-based version of diff(), delegating for now
Browse files Browse the repository at this point in the history
I'm going to implement a `Stream`-based version optimized for
high-latency (RPC-based) commit backends. So far, that implementation
is about 20% slower in the Linux repo when running `jj diff
--ignore-working-copy -s --from v5.0 --to v6.0`. I think that's almost
only because the algorithm is different, not because it's async per
se.

This commit adds a `Stream`-based version of `MergedTree::diff()` that
just wraps the regular iterator in stream. I updated `jj diff` to use
it. I couldn't measure any difference on the command above in the
Linux repo. I think that means we can safely use the same
`Stream`-based interface regardless of backend, even if we end up
needing two different implementations of the `Stream`. We would then
be using the wrapped iterator from this commit for local backends, and
the new implementation for remote backends. But ideally we can make
the remote-friendly implementation fast enough that we don't need two
implementations.
  • Loading branch information
martinvonz committed Nov 2, 2023
1 parent a7aae97 commit a6c0354
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 168 deletions.
2 changes: 1 addition & 1 deletion cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ fn cmd_status(
diff_util::show_diff_summary(
formatter,
&workspace_command,
parent_tree.diff(&tree, &EverythingMatcher),
parent_tree.diff_stream(&tree, &EverythingMatcher),
)?;
}

Expand Down
Loading

0 comments on commit a6c0354

Please sign in to comment.