Giter VIP home page Giter VIP logo

Comments (2)

ljones315 avatar ljones315 commented on July 30, 2024

There is a memory leak! I can't seem to recreate the slowness issue to confirm that my solution does anything to helpπŸ˜… but the memory issue does exist.

The problem is that in many visualizations the value of nextIndex continues to grow infinitely. It's more problematic on algorithms than data structures, because with DS each operation adds a small constant amount to nextIndex but with algorithms it adds a larger amount proportional to the input size.

And the issue obviously isn't just the integer nextIndex, but what it represents which is the label # of the next animated object. At any time there is an array of animated objects being stored in this.animationManager.animatedObjects.nodes, and as nextIndex grows so does the array. This leads to potentially hundreds of empty indices in the array each time the algorithm is run, which grows to thousands over time.

One solution that's already (sort of) being used in some visualizations is a "reset index", that allows for some constant objects to avoid be reinstantiated and resets nextIndex each time the algorithm is re-run.

Screenshot 2023-11-20 at 4 57 34β€―PM
Here's an example of that idea being implemented in Quicksort

Is there any particular vis where you noticed performance issues? We could test this fix there first

from visualization-tool.

luciankt avatar luciankt commented on July 30, 2024

I noticed it on algorithms like you said. On LSD Radix Sort, it happened during Dr. HB's lecture. I think she had the page up for a while off-screen, then when she pulled it up to demonstrate something, it was extremely slow. But what's curious is I don't know if repeatedly running the algorithm is the only cause - it seems like it just happens if you leave the page open for a while in the background? I'll try and see if I can replicate it by doing that.

from visualization-tool.

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.