In a previous blog post I mentioned that you should use WebService load on demand in order to squeeze the most performance from RadTreeView. In this post I will show a few other tricks which can be used to improve the loading time even further. All techniques are optional and can be used independently.
We start with a simple page containing only a single RadTreeView control with one root node. The testing environment is:
Here is the test page:
The code in nodePopulating and nodePopulated is used to measure the actual time required to load 1000 nodes from web service.
Here is how the web service method looks like:
Now the page runs fine. Expanding the node takes about 3500ms
Let's see if we can do anything to improve that time.
The first thing to try is use a custom class to serialize less output than RadTreeNodeData. Here is what I mean:
This dramatically decreases total size of JSON which goes back to the client browser. It also improves the time to load 1000 nodes to about 3000ms:
Setting the PersistLoadOnDemandNodes property to false would also improve performance. However the nodes loaded on demand won't be able to fire server-side events (NodeClick, NodeDrop etc). There are workarounds still - using RadAjaxManager to simulate postbacks. Disabling node persistence cuts of the loading time almost in half - to about 1700ms:
Either set <compilation debug="false"> in your web.config our set the ScriptMode property of the ScriptManager to "Release". This is a general performance tip when working with RadControls for ASP.NET Ajax. Always deploy your web sites with <compilation debug="false">. In this case the load time got to about 1400ms:
By using a skin with no line images (e.g. "Vista") or setting the ShowLineImages property to "False" you can improve the loading time even more - now it takes 756ms to load 1000 nodes!
Now let's try in the other browsers.
Iana Tsolova is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.