Fork me on GitHub

Random suggestion. What about integrating in something like into cursive? I feel like intelliji diff options are already better then anything out there, having syntax aware changes would be pretty awesome.


@drewverlee Yeah, I saw that and made a mental note to check whether the diff algorithm is pluggable. I haven’t got around to actually checking it though. I also think that that diff algorithm is pretty expensive for large files with multiple change locations.


> For example, If you split a 100-line function into two pieces and also make a bunch of changes, it might take like 30 seconds to diff. That’s not great, but you’ll probably spend more than 30 seconds looking at a diff like that anyway.


While that’s true, people will probably get upset if they have to wait 30 seconds to then spend more than 30 seconds looking at it 🙂


I suspect that there are a lot of degenerate cases that might cause that sort of behaviour. It might be possible to do something like put a time bound on the diff and if it’s violated then default to the previous behaviour though.


Looking at it, I can’t immediately tell how easy that would be.


(swapping the algorithm, that is)


@cfleming Yea, there are a lot of unknowns here for me at least. It seems like a topic that would be well researched but here we are in 2018 without structural diffs? Or i’m i missing something? So i’m not sure what all the dark corners are. If its just a performance issue, then It would be exciting to see what sort of options were out there to make it go faster. Algorithms, etc…


Both the associated webpage ( and the original blog ( are well worth a read.


tl;dr is that general tree diffing is hard (O(n^3) in the naive case IIRC)


Good point! He did put out a lot of material, i just say this yesterday so i haven’t had time to dig in. I just thought i would mention it here in case it hadn’t caught your eye as it seems like a potentially great addition.


Yes, definitely!


Do read the tree-diffing blog post, it’s pretty great.


You’ll need a cup of coffee though.


Yea. I’ll have to give it a read. If anything It will probably be highly educational. What i remember from algorithms is that even if that truly is the big O you might be able to get away with some combination of algorithms to keep the average acceptable to users.


Also, interesting HN comments on the original submission:


Sure, he talks about using A* to prune the search space, and dynamic programming to keep the runtime under control (at the cost of memory)


Cool, the one algorithm i have ever employed in building something 🙂


Bookmarked it all. Thanks!


> The tree differencing problem has been largely investigated when considering only the add node, delete node and update node actions [4]. For this problem, many optimal algorithms have are described in the literature. The fastest algorithms of this family [27] run in O(n^3), which can result in significantly long edit script computation time for large source code files. The other issue faced by these algorithms is their inability to uncover moved nodes, which is a frequent action in sourcecode files. It results in unnecessarily big edit scripts which are hard to understand. > When considering move node actions, the problem of finding the shortest edit script between two trees becomes NP-hard.


But there are heuristics available.


@cfleming Awesome news on supporting Lumo or Planck — I’m indifferent to either… I chose Lumo because it was the first one where I found support for easy file I/O. FWIW, I loved using it because it was so fast and the fan stayed off on my MacBook Pro. 🙂 (Not complaining about Clojure JVM or CLJS compile times… But it was refreshing! :)


(Not a high priority for me at all… Was wonderful to solve a small problem today with Lumo, though!)


@genekim Indeed, I use Lumo for a couple of release scripting tasks - the lack of symbol resolution is a pain but for small things it’s still nice. I definitely want good support for it though!