Performance with thousands of displayed controls

6 posts, 1 answers
  1. Tomáš Čeleda
    Tomáš Čeleda avatar
    15 posts
    Member since:
    Sep 2009

    Posted 07 Feb 2011 Link to this post

    Hello,
    I want to display measurement data onto map. There are about 100 000 or more points in database for one region (about 10 square kilemeters). Can you tell me what is the best practise for achieving good performance and if the RadMap is capable of this. I am not interested in cool graphical effects. The application is intended for internal use.

    I have tried displaying the items using dynamic layer. The displayed objects are simple rectangles with solid fill color. With 1000 objects in a layer the map is very slow. The databinding itself takes about 60 seconds and then panning is quite slow (about 1 fps). The slowness occurs when the points are loaded into layer regardless if they are currently displayed or not.

    Thank you
    Regards
    Tomas Celeda
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 09 Feb 2011 Link to this post

    Hello Tomáš Celeda,

    Mostly, the performance of dynamic layer depends on its ZoomGridList you use in your application.
    The optimal value for the Latitudes and Longitudes count depends on the viewport size of the map control and the min zoom level of the zoom grid. I think that the dynamic layer will have best performance when the square size for request will be approximately equal to the viewport size (of course if you want to reduce a number of requests to the service, then you can use more large square size).
    The count could be calculated using the following way:
    1. For example the viewport size is 1024x1024.
    2. The map size is 512x512 when the zoom level is 1, 1024x1024 for 2 and 2048x2048 for 3 etc. The map size is calculated as 2 ^ (zoom level + 8).
    3. When the zoom level is 3, then the count could be calculated as 2048 / 1024 = 2. I.e. count is calculated as map size/ viewport size.

    I have attached a sample solution.
    It calculates ZoomGridList values automatically according to an approach above. The example generates collection of 100000 random locations which is used in the ItemsRequest implementation to retrieve locations within the requested square.

    All the best,
    Andrey Murzov
    the Telerik team

    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Tomáš Čeleda
    Tomáš Čeleda avatar
    15 posts
    Member since:
    Sep 2009

    Posted 09 Feb 2011 Link to this post

    Hello,
    thank you for your example and explanation. My problem is that I need to display a lot of points (more than 1000) at once (on single screen).  I have modified your solution to demonstrate the problem. I just changed density of generated points. When generating 100000 points, the program hanged. I had to lower the amount of generated points to 1000 to achieve slow but at least working solution.

    Random rnd = new Random();
     for (int i = 0; i < 1000; i++)
    {
           Location location = new Location(rnd.NextDouble() * 1 + 40, rnd.NextDouble() * 1 - 100);
          location.Description = i.ToString();
         shapes.Add(location);
      }

    Edit: I have figured out that the time complexity of displaying points is not linear to the number of points.
    With 1000 points displayed, it takes about 10 second to display. With 2000 points it is about 26 sec and with 4000 points it is about 2:10.

    Thank you,
    Best regards,
    Tomas Celeda
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 14 Feb 2011 Link to this post

    Hello Tomáš,

    The dynamic layer adds/removes items dynamically. It works with squares which are calculated according to its ZoomGridList.
    When a square appears within the visible area of map then the dynamic layer adds its items into the view. When a square gets out from visible area then the dynamic layer removes its items.
    During the panning a few squares can change its visibility. So, when these squares contain a lot of points (1000 or more) then this process takes a long time.
    I hope this information helps.

    Best wishes,
    Andrey Murzov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  6. Tomáš Čeleda
    Tomáš Čeleda avatar
    15 posts
    Member since:
    Sep 2009

    Posted 02 Mar 2011 Link to this post

    Hello Andrey,
    thank you for your reply. I'll try to figure out some other solution of displaying map with thousand points. I'll probably create the map as a bitmap on advance and than display a proper tooltip on it based on coordinates.
    Nevertheless I think that there is something wrong in the implementation of dynamic layer, because the time required to display items should rise lineary with amount of displayed points. My rough figures of display time (in previous post) show that the time rises faster.

    Best wishes
    Tomas
  7. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 07 Mar 2011 Link to this post

    Hi Tomáš Čeleda,

    Thank you for the feedback. We are working on our controls continuously to make them better. The initialization time for any ItemsControl don't grows linearly. The curve depends on many things, but mostly depends on the memory allocation and internal Silverlight rendering engine. At the beginning the curve mostly looks like the line, but after some number of items (depends on the data complexity, complexity of the ItemTemplate and so on) it become steeper. This is why items virtualization things are so important in the Silverlight and WPF.

    Regards,
    Andrey Murzov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top
DevCraft banner