Performance Question

2 posts, 1 answers
  1. Mike
    Mike avatar
    11 posts
    Member since:
    Aug 2011

    Posted 09 Mar 2012 Link to this post

    Hello.  I'm looking for performance optimizations in my web application which uses kendoUI.  Which of these approaches would you expect to be faster?

    Approach 1:
    Build a large DOM tree full of <ul> and <.li> elements, representing a kendo treeview.  When all DOM elements are constructed, call .kendoTreeView(); so that each set of DOM elements is converted to a treeview.

    Approach 2:
    Build a large JSON structure representing kendo treeview data.  Initialize the kendotreeview in the page by calling .kendoTreeView() and then insert the data into the tree by calling the append function

    Or is there another even better way than either of these approaches?
  2. Answer
    Alex Gyoshev
    Alex Gyoshev avatar
    2527 posts

    Posted 12 Mar 2012 Link to this post

    Hello Mike,

    Initializing the treeview directly from JSON is faster, as it does not need to parse the DOM tree (which, as every DOM operation, is slow):

        dataSource: [
            { text: "foo" }

     Using append() to add the items is as fast as initializing the treeview from JSON.

    Alex Gyoshev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top