1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    16
    Vote Rating
    3
    vxviper is on a distinguished road

      0  

    Default Performance hit when loading nodes in a tree

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you tried suspendEvents and resumeEvents?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    16
    Vote Rating
    3
    vxviper is on a distinguished road

      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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Try not queuing the events, may have to force the update after the resume
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Apr 2010
    Posts
    16
    Vote Rating
    3
    vxviper is on a distinguished road

      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.

Thread Participants: 1