Coder Social home page Coder Social logo

Loading of Large File Hangs about diffplex HOT 5 OPEN

ajardolino3 avatar ajardolino3 commented on May 19, 2024
Loading of Large File Hangs

from diffplex.

Comments (5)

mmanela avatar mmanela commented on May 19, 2024

Is the delay from the core lib or the UI control?

from diffplex.

Drake53 avatar Drake53 commented on May 19, 2024

I have the same issue (using DiffPlex.Wpf v1.3.1 in my NET5 winforms application).

The files that I tested were 40k lines of JSON.
The loading appears to happen during form.ShowDialog(), and when I try SideBySideDiffBuilder.Diff() it completes pretty much instantly, so it seems to me that the delay is in the UI control. (it also slowly consumes more and more RAM, up to around 2GB before I run out and have to kill the process in task manager)

Looks like the same issue as here: #87

from diffplex.

lanboss avatar lanboss commented on May 19, 2024

i try, WebDiffer is fast, DiffPlex.Wpf is slow , InsertLinesAsync method is slowly , InternalLinesViewer ->StackPanel add
VirtualizingStackPanel.VirtualizationMode="Recycling" VirtualizingStackPanel.IsVirtualizing="True"
will not slow when drag,but load file still slow

from diffplex.

lanboss avatar lanboss commented on May 19, 2024

i solute the question , changed InsertLinesAsync method
private static async Task InsertLinesAsync(Guid guid, InternalLinesViewer panel, List<DiffPiece> lines, bool isOld, UIElement source, int contextLineCount) { // For performance. if (lines == null || panel == null) return; var disablePieces = lines.Count > MaxCount; var i = 100; if (panel.TrackingId != guid) return; InsertLinesInteral(panel, lines.Take(i).ToList(), isOld, source, disablePieces); while (i < lines.Count) { //await Task.Delay(i > 5000 ? 1000 : 800); if (panel.TrackingId != guid) return; await panel.Dispatcher.BeginInvoke(() => { InsertLinesInteral(panel, lines.Skip(i).Take(100).ToList(), isOld, source, disablePieces); }, DispatcherPriority.Background); i += 100; } if (contextLineCount > -1) CollapseUnchangedSections(panel, contextLineCount); }
2 points:
500-> 100
Invoke ->BeginInvoke ,thread level is DispatcherPriority.Background

from diffplex.

lanboss avatar lanboss commented on May 19, 2024
    private static async Task InsertLinesAsync(Guid guid, InternalLinesViewer panel, List<DiffPiece> lines, bool isOld, UIElement source, int contextLineCount)
    {   // For performance.
        if (lines == null || panel == null) return;
        var disablePieces = lines.Count > MaxCount;
        var i = 100;
        if (panel.TrackingId != guid) return;
        InsertLinesInteral(panel, lines.Take(i).ToList(), isOld, source, disablePieces);
        while (i < lines.Count)
        {
            //await Task.Delay(i > 5000 ? 1000 : 800);
            if (panel.TrackingId != guid) return;
           await panel.Dispatcher.BeginInvoke(() =>
            {
                InsertLinesInteral(panel, lines.Skip(i).Take(100).ToList(), isOld, source, disablePieces);
            }, DispatcherPriority.Background);
            i += 100;
        }
        if (contextLineCount > -1) CollapseUnchangedSections(panel, contextLineCount);
    }

from diffplex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.