Select to view content in your preferred language

GraphicsLayer.ClearGraphics performance problem even worse with v2.0

754
3
09-29-2010 11:41 AM
AndySanford
Emerging Contributor
The performance of GraphicsLayer.ClearGraphics() is very slow, and 2.0 is slower than 1.1:

In Feb 2010, I reported a performance problem for v1.1 of the Silverlight web mapping APIs:
calling GraphicsLayer.ClearGraphics() on a layer that has around 2200 graphics (SimpleLineSymbols) on it was very slow:
http://forums.esri.com/Thread.asp?c=158&f=2455&t=301151#941657

I've run my latest code to compare performance of v1.1 (silverlight 3) to 2.0 (silverlight 4.)  It appears using my current code base that ClearGraphics() in v2.0 is on average 67% slower than v1.1, and 1111% slower than the bing equiv.  In absolute time terms, my slowest ClearGraphics() now compares as follows:

v2.0 = 3.89 seconds
v1.1 = 2.42 seconds
bing = 0.24 seconds

So, this is not a minor amount of time to wait.  Since these are UI controls, I think I need to clear these on the UI thread - and so the UI hangs up for almost 4 seconds in the above case - and that is before I start drawing new graphics.

On a positive note, it does appear the times to actually render new graphics has improved by about 67% going from v1.1 to 2.0 (thanks!); however, the absolute times for rendering are all less than a second, and so this change has significantly less impact on the overall performance of my system than the ClearGraphics() method performance does.

Is there anyway to speed up or work around ClearGraphics()'s slow performance?  Is there a new version coming that might be able to improve this issue?  It seems this function's performance is going in the wrong direction.

Thanks for your help!
0 Kudos
3 Replies
dotMorten_esri
Esri Notable Contributor
We have identified the issue as a problem with Silverlight. However we have a workaround in place, and you should see vastly improved performance (10-20x) in the next release. Sorry for the inconvenience, and thanks for reporting this.

For what its worth, Bing would also be similarly affected if you tried to do the same amount of functionality that our graphics does 🙂
0 Kudos
AndySanford
Emerging Contributor
Hi,

I just installed and tested with v2.1 (2.1.0.446), and the ClearGraphics() performance is hugely improved over v2.0; thanks!  My worst case for ClearGraphics() in 2.0 was about 3.89 seconds; the same action in v2.1 takes only about 0.17 seconds!

Thank you, thank you, thank you!
0 Kudos
dotMorten_esri
Esri Notable Contributor
Glad you like it! And thank you for reporting it in the first place 🙂

We have also forwarded the issue to Microsoft, and they are now aware of the problem and looking into resolving this so developers doesn't have to work around this.
0 Kudos