Skip to content

Tips for creating massive amounts of shapes

I am often asked how to reduce the creation time for a massive number of shapes.


Try a few things:

1)      Use XamlReader.Load when you can (with the mini-language), which allows you to use the native parser and not managed code to create new shapes

2)      Use the mini-language for Paths or lines (whether using Xamlreader or C#) – both Silverlight and WPF optimize the mini-language internally, in different ways. When the mini-language is used, Silverlight does not create managed object for each PathFigure, Point etc– which saves creation time and space:


3)      Switch to Bitmaps if appropriate.

4)      Prototype! Prototype! Prototype! Don’t write everything and realize that SL can’t generate 100,000 managed objects every 10msec. =)


Generally, for drawing massive number of shapes, you want to reduce the amount of time spent in managed creation time.


Post a Comment

Your email is never published nor shared. Required fields are marked *