mmanela / diffplex

DiffPlex is Netstandard 1.0+ C# library to generate textual diffs.
Apache License 2.0
990 stars 183 forks source link

Massive performance improvement with large [25k+] documents in WPF. #95

Open ben-abraham opened 2 years ago

ben-abraham commented 2 years ago

Can now easily handle 25k+ line files in side-by-side mode.

You can increase the repetitions in MainWindow.xaml.cs to 1000 to get a 25k line document, which is handled on my system easily.

Let me know if there are any improvements you can offer. The style mechanism could be improved to be more pure-wpf, and I think the font properties might already inherit by default (although I'm not 100% sure about this one, I need to test it)

ben-abraham commented 2 years ago

Note: a big missing feature with this now, is that you can't highlight/select the text at all since they are now TextBlock objects.

There are a few solutions that could fix it I think, but they would be fairly involved.

mmanela commented 2 years ago

@ben-abraham Thanks for contributing. It's an interesting change although making text not selectable is a bummer.

@kingcean can you take a look and share any thoughts?

kingcean commented 2 years ago

Looks good!

ben-abraham commented 2 years ago

Sorry for the lack of update, I'm trying to implement this with Document/Span elements directly without virtualization, which seems performant enough by itself, and should allow selection to work as well. Just having trouble getting the look to match quite right, so I kind of have to rework the WPF styles to make it work correctly. Also a few bugs related to scroll bars that need to be sorted out.

mmanela commented 1 month ago

@ben-abraham It has been a while, so pinging on this. Are you still interested in moving this forward (with or without your follow up changes). I am looking at doing some housekeeping and seeing if this is something we can get it to help it be lean and fast.