How can I improve the performance of add items with client side?

14 posts, 0 answers
  1. Winson qiu
    Winson qiu avatar
    20 posts
    Member since:
    Aug 2009

    Posted 29 Sep 2009 Link to this post

    I would like to add about 10000 recoders to a RadListBox in client side, I used the follows code:

    var getCallBack = function(returnValue) { 
                    items = returnValue.value; 
                    if (items != null && items != "") { 
                        var rows = items.Tables[0].Rows, i = 0, l = rows.length;                     
                        for (; i < l; i++) { 
                            //add new items 
                            var raditem = new Telerik.Web.UI.RadListBoxItem(); 
                            raditem.set_text(items.Tables[0].Rows[i].Description); 
                            raditem.set_value(items.Tables[0].Rows[i].Code); 
                            oRadListItems.add(raditem); 
                        } 
                    } 
                } 

    it will be very slow when large items (about 10000 records) , and the browser will be halts.

    if I use html control (select), I can use array to do this, then it will be very fast , just like
    for (; i < l; i++) { 
                k.push("<option value='" + items.Tables[0].Rows[i].Code + "'>" +  items.Tables[0].Rows[i].Description + "</option>"); 
            } 

    so I don't know whether can I improve the performance of RadListBox, have any idea to solve this ?

    thank you !



  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 30 Sep 2009 Link to this post

    Hi Winson qiu,

    You can use the newly added insertItems method of the RadListBox. It serves for bulk insert of items and will dramatically reduce the load time. Unfortunately, the method is having problems  under IE, it takes about 18 seconds to insert 10000 items. We have looked into that issue and it is already fixed. You can find the fixed version in the tomorrow's internal build. More information on how to obtain the latest internal can be found here.

    For your convenience I have attached sample project that reproduces the bulk insert approach. The sample adds 10000 items in one operation.

    All the best,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Winson qiu
    Winson qiu avatar
    20 posts
    Member since:
    Aug 2009

    Posted 30 Sep 2009 Link to this post

    Thank you so much!!
  5. Winson qiu
    Winson qiu avatar
    20 posts
    Member since:
    Aug 2009

    Posted 04 Oct 2009 Link to this post

    I have tried the new method, it really faster then before, but when I try to add 10000 item , it still slow , it taks about 2 minute to finished, and you said it takes 18 seconds for this , have any mistakes in my code ?

    function Test() { 
                    var listBox = $find("RadListBox1"); 
                    var oListItems = listBox.get_items(); 
                    var arr = []; 
                    var s = ""
                    var d = new Date(); 
                    s += "\n\r start time is: "
                    s += d.getMinutes() + ":"
                    s += d.getSeconds(); 
                    //oListItems.clear(); 
                    for (var i = 0; i < 10000; i++) { 
                        var item = new Telerik.Web.UI.RadListBoxItem(); 
                        item.set_text("text" + i); 
                        item.set_value("text" + i); 
                        arr[i] = item; 
                        //oListItems.add(item); 
                    } 
                    listBox.insertItems(arr); 
                     
                    d = new Date(); 
                    s += "\n\r end time is: "
                    s += d.getMinutes() + ":"
                    s += d.getSeconds(); 
                    alert(s); 
                }   

    the result is :
    start time is: 3:13
    end time is: 5:33

    thanks!



  6. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 07 Oct 2009 Link to this post

    Hi Winson qiu,

    The time that goes for the insertion of 10 000 items strongly depends on the speed of the computer you are testing on. If you run it on a slower machine you will get higher execution time.

    We have done some additional improvements on the insertItems method.Now it should work even faster than before. You can verify it on the latest internal build. More information on how to obtain the latest internal can be found here. Please, give it a try.

    Greetings,
    Genady Sergeev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Winson qiu
    Winson qiu avatar
    20 posts
    Member since:
    Aug 2009

    Posted 07 Oct 2009 Link to this post

    Oh, I see, thank you !
  8. Ajay Gandhi
    Ajay Gandhi avatar
    15 posts
    Member since:
    Mar 2010

    Posted 20 Apr 2010 Link to this post

    I am binding the RadListBox on the serverside with a dataset that gets data from the database. There are about 2000 rows. It takes about 8 secs to load. Could you please help?

    I tried using the built-in listbox web control and it takes 3 secs to load.
  9. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 21 Apr 2010 Link to this post

    Hello Ajay Gandhi,

    We are aware of that issue and have already worked on improving RadListBox performance. The fix is going to be available together with the next internal build. More information on how to obtain the latest internal build can be found here.

    Sincerely yours,
    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. Ajay Gandhi
    Ajay Gandhi avatar
    15 posts
    Member since:
    Mar 2010

    Posted 21 Apr 2010 Link to this post

    Thank you for the quick response. I see a build 2010.1. Is the fix available in this build?
  11. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 22 Apr 2010 Link to this post

    Hi Ajay Gandhi,

    The build is going to be available later today or tomorrow at latest.

    Greetings,
    Genady Sergeev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  12. Ajay Gandhi
    Ajay Gandhi avatar
    15 posts
    Member since:
    Mar 2010

    Posted 28 Apr 2010 Link to this post

    Is the build available now?
  13. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 29 Apr 2010 Link to this post

    Hi Ajay Gandhi,

    Yes, please download the latest internal build from your Client.Net account.

    Kind regards,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  14. Ajay Gandhi
    Ajay Gandhi avatar
    15 posts
    Member since:
    Mar 2010

    Posted 29 Apr 2010 Link to this post

    Questions:

    1. There is only one internal build '2010.1'. When I read the things that got fixed in this build there is no mention of the problem that I am facing. Are you guys sure this is the fix I am suppose to download?

    2. If yes, how do we apply the fix on our systems?

    3. What is client .NET account?

    4. It clearly mentions that you guys have not tested  the build in QA and do not support it. What does that mean?

  15. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 04 May 2010 Link to this post

    Hello Ajay Gandhi,

    Straight to the questions:

    1. May be your fix is included in the previously uploaded build, but it will be available also in the current one, so download it and give it a try.

    2. You can use either the installer or the hotfix package containing the dlls, this article might be of help.

    3. Client.Net account is actually your account on the Telerik site.

    4. Please check this blog post about this question.

    Kind regards,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017