Git Product home page Git Product logo

Comments (4)

BeksOmega avatar BeksOmega commented on May 5, 2024 1

But, what you propose sounds like indexing of blocks by a tag, so why not just use an object of key -> array of blocks.

An object like {key, [blocks]} is indeed the basic idea. The proposal just adds some utility functions to make things easier.

Using utility functions allows us to save information about where the block is stored to the block. We need to know where the block is stored so that when we dispose of the block we can remove it from all collections. If it gets left in a collection we'll get detached nodes :/

So addBlockToCollection, removeBlockFromCollection, and removeBlockFromAllCollections are just to make it so you don't have to think as much when you dispose of your block.

from blockly-samples.

maribethb avatar maribethb commented on May 5, 2024 1

@BeksOmega How do you feel about moving this to samples?

Rachel and I discussed and we don't think this belongs in core-

  1. It's doable as a plugin right now using events
  2. The main use case you laid out, procedure blocks, are going to have their own management system thanks to the shared procedures API / procedure maps

from blockly-samples.

seldomU avatar seldomU commented on May 5, 2024

I would have use for such collections and see workspace analysis performance as the main benefit. But I'm not sure if it should be part of Blockly or be left to projects to add if needed. Updating collections could be handled outside Blockly by a workspace event listener.

from blockly-samples.

jollytoad avatar jollytoad commented on May 5, 2024

So, wrt to solution 1 above, if you are just iterating through plain old JS objects (ie. not DOM) then it should be perfectly fine performance wise, even when the block count reaches 1k or more. Performance problems usually only surface when DOM (or other non-JS API) interactions are involved.

But, what you propose sounds like indexing of blocks by a tag, so why not just use an object of key -> array of blocks.

from blockly-samples.

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.