Results 1 to 5 of 5

Thread: Performance hit when loading nodes in a tree

  1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    16
    Vote Rating
    3
      0  

    Default Performance hit when loading nodes in a tree

    Hi, I just wanted to give people working with the tree panel component the heads up.

    In ExtJS 3.x nodes were not records, in ExtJS 4.x they are and you would think that the correct way to alter it's properties is through the set function.

    Now, suppose you are loading a couple of hundred nodes, and for each node you modify through the set function some of it's attributes (for example, after the store fires the load event). While in 3.x this was not an issue, in 4.x, calling the set function so many times would cause a big performance hit, proportional to the number of nodes and attributes being modified.

    Instead, what can be done, is alter the node.data object and, when all the nodes are ready, call the refresh function in the tree view object.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    Have you tried suspendEvents and resumeEvents?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    16
    Vote Rating
    3
      0  

    Default

    Yes, and executed like this:

    node.suspendEvents();

    node.set('field1', 'value1');
    ........
    node.set('fieldN', 'valueN');

    node.resumeEvents();

    Still slow compare to the other approach.

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    Try not queuing the events, may have to force the update after the resume
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha User
    Join Date
    Apr 2010
    Posts
    16
    Vote Rating
    3
      0  

    Default

    The events are not queued by default (I passed false to be sure anyway). Still slow.

    It looks like the set function has a lot of overhead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •