diff options
author | Wilfred Hughes <me@wilfred.me.uk> | 2021-10-18 22:17:49 -0700 |
---|---|---|
committer | Wilfred Hughes <me@wilfred.me.uk> | 2021-10-18 22:23:44 -0700 |
commit | 4287594cdaab2fc97a4510fd15c04d8373d92dce (patch) | |
tree | d43971892643f9ca5e851325d1d0ff99d79aedf2 | |
parent | 7f426070f6a8ec547b74d86cfd128b2a0cbfafac (diff) |
Don't consider other paths when UnchangedNode is available0.11.0
This substantially decreases the number of edges in our graphs,
especially when few nodes have changed. Diffing slow_before.rs with
slow_after.rs now takes half the time on my machine.
This makes diffing slightly greedier, so there may exist cases where
diffs are slightly worse. Comparing AXAB with AB is arguably nicer
as (+AX)AB rather than A(+XA)B. However, all the tests still pass,
and it's a huge perf win.
Closes #47
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | src/graph.rs | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b7a6bae6..8a9b4b5cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ more granular). Fixed a rare issue where single-item lists were flattened. +## Diffing + +Diff calculations are now greedier when syntax nodes are identical, making +diffing significantly faster when most syntax nodes are the same. + ### Integration Added support for Mercuial, see [this section in the diff --git a/src/graph.rs b/src/graph.rs index 7decda9e4..5b6a8f53b 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -164,7 +164,7 @@ pub fn neighbours<'a>(v: &Vertex<'a>, buf: &mut [Option<(Edge, Vertex<'a>)>]) { rhs_prev_is_novel: false, }, )); - i += 1; + return; } if let ( |