Giter Club home page Giter Club logo

Comments (2)

hpeinar avatar hpeinar commented on July 21, 2024

Indeed looks so. Will have to have a look into this.

from stardewplanner.

Ailuridaes avatar Ailuridaes commented on July 21, 2024

I don't know if you've had a chance to look at this yet, but I spent some time digging into it and it looks like slowdown is caused by the event handlers for old boards not being unregistered on layout change. Particularly the board.R.drag handler - as soon as I called undrag() on layout change the brush dragging became much snappier. You can inspect board.R.events in the console and see that there's a set listed per layout loaded.

Instead of cleaning up and then initializing a new board, we can just swap in the board parts that need to be changed. I tested this locally, and it looks like your board.loadLayout method handles everything you need on layout change. All of the handler, helper, defs, etc setup in the board constructor is still good to go and doesn't need to be re-executed if we're using the same board.

I made a PR with that change so you can test it out yourself. If there's a reason to initialize a new board though, you can also fix the performance drop by unregistering the events from the old board on layout switch.

from stardewplanner.

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.