Search
Saturday, October 19, 2019 ..:: Blendblog.net ::.. Register  Login
 Bloggers Minimize

  
 Sponsors Minimize

 Print   
 Users Online Minimize
Membership Membership:
Latest New User Latest: KellyFenton
New Today New Today: 1
New Yesterday New Yesterday: 2
User Count Overall: 8149

People Online People Online:
Visitors Visitors: 8
Members Members: 0
Total Total: 8

Online Now Online Now:

  
 Welcome to blendblog.net! Minimize

If you are a developer or designer who is creating cutting edge user interface experiences using Microsoft Expression Blend you've just found a great resource!  The purpose of this site is to share our experience with this brand new product.  As with any new piece of software there is a ton to discover.  Bugs will be revealed and workarounds discovered, hopefully this can be a resource to share in the discovery process!

While this site will focus largely on Expression Blend, it will also encompass WPF, Visual Studio, Silverlight, and other .net 3.5 technologies as they relate to the creation of great software.

Please login using your Microsoft LiveID or register a new account.  Doing so will let you comment on any of the blog entries on the site.  We look forward to helping you in your endeavors as well as you helping others in theirs!  We'd love to have more bloggers on our site...if you are interested please register and contact us!

Follow us:


  
 Massive listbox performance improvement and loading resources from resource dictionaries Minimize
Location: BlogsSean Cullinan    
Posted by: Sean Cullinan 5/23/2008 2:16 PM

I've been busy showing off the work we've been doing in WPF to our clients, both in the UK, and in Las Vegas at a tradeshow.  We had ramped up to these events and while we had a very nice, working application the performance was just terrible.  We were hoping SP1 of the .net framework 3.5 would fix things, but when we installed Beta 1 of this it didn't fix our performance headaches.  Off of the tight deadline I was able to do some code profiling and found my problems.

To sum things up, any time you are loading up a resource dictionary you will take a performance hit.  Do a search in your code ASAP for "= New Uri" across your application and ask yourself "when does this get called?"  If its called frequently consider caching the resource at the module or global level of your application and re-using the copy in memory, your application will run much faster for it.

My listboxes were using a multi-valueconverter to determine which image to display in the template next to the text for the listbox.  What I discovered was that the convert method of the multi-valueconverter was creating a new object of a utility class that I have to work with a large resource dictionary containing vector images.  On the constructor for that class I was calling the following code:

        mobjResourceDictionary = New ResourceDictionary
        mobjResourceDictionary.Source = New Uri("pack://application:,,,/UtilLib;component/VectorImages.xaml")

So for each item in the listbox it was loading this resourcedictionary.  That was my bottleneck.  My solution was to declare my utility class at the module level in my IMultiValueConverter class and on the constructor create the new object of the utility class, then use that object in the convert routine.  Since it only loads the resource dictionary one time (at load time of the app in fact) the render of the list box went from taking 3 seconds with 200 items to under a second (instantaneous to the user).  Further, because I am using a virtualizing stack panel in my listbox template, scrolling the listbox is now smooth whereas in the past it was choppy.

I went through my application and noticed several other places where I was loading up resource dictionary objects.  I decided that I would avoid this at all costs, loading them once preferrably when my splash screen was up and then re-usuing the global resourcedictionary objects that I create at that time across my application.  Once I did this I fixed a ton of performance problems.  For instance, I had code that was loading a resource dictionary up in my gotfocus/lostfocus events of a control I wrote that was drastically slowing things down. 

While it seems so obvious now, a lot of the sample/demo code out there arbitrarily loads resources up.  In practice this SHOULD NOT BE DONE frequently, you should load your resource dictionary up and startup and re-use your object in your app to keep it in memory.  Taking this approach has drastically increased the speed of my application.

Sean

Permalink |  Trackback

Comments (2)   Add Comment
Re: Massive listbox performance improvement and loading resources from resource dictionaries    By michael kors on 12/25/2013 10:17 PM
Sure, we're perfectly aware that there's a handy little app on your phone that <a href="http://www.michaelkorshandbagsnew2013.com/" title="michael kors">michael kors</a> all your appointment organizational needs. But we're also aware that <a href="http://www.louisvuittonblackfridaybags.com/" title="louis vuitton">louis vuitton</a> are a ton of people out there who actively avoid using said app because they'd rather write down their appointments in a stylish agenda book. If you fall into that category, shop my picks for 16 cute planners you'll wish <a href="http://goo.gl/OY98HY" title="michael kors handbags">michael kors handbags</a> had come 2014. <a href="http://www.coachstoreonline.com/" title="Coach Outlet">Coach Outlet</a> If you spend even half as much time poring over runway images as we do, you've no doubt asked yourself how you can make the season's biggest trends your <a href="http://www.marcby-marcjacobs.com/" title="marc by marc jacobs">marc by marc jacobs</a>. That's why we've enlisted senior associate accessories editor <a href="http://www.coachfactoryoutlet2014.com/" title="coach factory">coach factory</a> Lemos to get our fall wardrobes in shape <a href="http://www.sugarsit.com/" title="coach outlet">coach outlet</a> a dose of runway inspiration-and a <a href="http://www.marcjacobsmarc.com/" title="marc jacobs handbags">marc jacobs handbags</a> help from some stylish readers.</p><br><p>You already know that pink is one of this season's top colors. But <a href="http://www.coachoutletstoreonline2014.com/" title="coach outlet store online">coach outlet store online</a> you may have missed is that this isn't your average <a href="http://goo.gl/C3aqu1" title="louis vuitton outlet">louis vuitton outlet</a>-colored garb. Winter's standout take on the trend involves plenty of alternative details like far-out flat shoes, zippers, and even a little leather. I thought I'd put together a smorgasbord of Christmas <a href="http://www.marcbymarcjacobs.org/" title="marc by marc jacobs">marc by marc jacobs</a>, through the medium of GIF, because, you <a href="http://www.coachfactoryhandbagsoutlet.com/" title="coach factory handbags outlet">coach factory handbags outlet</a>, CHRISTMAS. Enjoy.Bryon here to <a href="http://www.coachhandbagsnew2013.com/" title="coach handbags">coach handbags</a> for you over the busiest part of the holiday season for the second-straight year. <a href="http://www.sportfanatics.org/" title="cheap jerseys">cheap jerseys</a>, I challenge you to run 50 miles or more (we'd love to see how much more you can log, too!) from December 24th through January 1st. Yeah, that's nine days… but nine days filled with gravy and grandma, football and feasts, presents and parties. Amidst all of that, get out there and make some time for yourself and your running!You already <a href="http://www.marcjacobsoutletstore.com/ " title="marc jacobs outlet">marc jacobs outlet</a> that pink is one of this season's top colors. But what you may have missed is that this isn't your average candy-colored garb. Winter's <a href="http://www.coachfactoryoutlet2014.com/" title="www.coachfactory.com/stroe">www.coachfactory.com/stroe</a> take on the trend involves plenty of alternative details like far-out flat <a href="http://www.coachfactoryoutlet-purses.com/" title="coach factory outlet">coach factory outlet</a>, zippers, and even a <a href="http://goo.gl/8PkSUC" title="coach factory outlet">coach factory outlet</a> leather. </p><br><p>This post is for the gals who <a href="http://www.marcjacobsinc.com/" title="marc by marc jacobs bags">marc by marc jacobs bags</a> on hitting the gym even though we are far, far away from bikini season. We know you want to show off those arm muscles without looking crazy, so pair the J.Crew <a href="http://www.michaelkorsoutlet-store.com/" title="michael kors outlet">michael kors outlet</a> Cate Cami In Sequin ($425) with a tight pair of black jeans and your well-defined biceps to look good anytime of the year. Respect.You don't have to be a member of the Addams family to sport a Gothic look this party season. Try feathers, lace and sequins for a softer take on the trend At this time of year, snoozing becomes the <a href="https://sites.google.com/site/marcjacobsoutletshop/" title="marc jacobs outlet">marc jacobs outlet</a> sport. Handy, then, that pyjamas have been given a luxurious new look, says <a href="http://goo.gl/JaGdpL" title="fitflops">fitflops</a> Akbareian.If you spend even half as much time poring over runway images as we do, you've no doubt asked yourself how you can make the season's <a href="http://azscitechfest.asu.edu/prada-outlet-australia" title="prada outlet">prada outlet</a> trends your own. That's why we've enlisted senior associate accessories editor Gisella Lemos to get our fall wardrobes in shape with a dose of runway <a href="http://www.louisvuittonhandbagsnew2013.com/" title=" louis vuitton handbags">louis vuitton handbags</a>-and a little help from some stylish readers.<a href="http://www.giuseppe-zanottifrance.com/" title="giuseppe zanotti">giuseppe zanotti</a> all of our valued readers and their <a href="http://www.marcbymarcjacobsinc.com/" title="marc by marc jacobs">marc by marc jacobs</a> a very Merry Christmas, a joyous festive <a href="http://www.chan-luu-inc.com/" title="chan luu">chan luu</a> and great things for <a href="http://www.marcjacobsbagsshops.com/" title="marc jacobs bags">marc jacobs bags</a> New Year.<br><br>

http://www.ukfitflops.com/    By fitflop shoes on 3/5/2014 9:55 PM
<p>We announced our run <a href="http://www.coach-factory-outlet-online.com/" title="coach factory">coach factory outlet online</a> and by Tuesday morning, we had emails from running crews around the world who wanted to take this <a href="http://www.michaelkorsoutletmkstore.com/" title="michael kors outlet">michael kors outlet</a> global, to which we said HELL YEAH! The <a href="http://www.coachfactoryoutlets2014.com/" title="coach factory">coach factory outlet</a> hue is much more fun, and it's made from a tougher <a href="http://www.coachfactoryoutletspurse.com/" title="coach factory outlet">coach outlet</a>.Models wear creations for <a href="http://www.michael-kors-outlet-store.com/" title="michael kors outlet">michael kors outlet</a>'s ready-to-wear autumn/winter collection. Since then, <a href="http://www.coachstoreonline.com/" title="coach outlet store online">coach outlet store online</a> got his physical act back together with some winter training in his <a href="http://www.coachoutletstoreonline2014.com/" title="coach outlet store online">coach outlet store online</a> as well as a trip to <a href="http://www.fitflopdesign.com/" title="fitflops">fitflop</a> summer in Patagonia.The 36-year old "<a href="http://www.coachhandbagsnew2014.com/" title="coach handbags">coach handbags outlet</a> Lines" singer returned to the stage last night for his first concert following the news of he and <a href="http://www.coachfactoryoutlethandbags.com/" title="coach factory handbags outlet">coach factory outlet</a>'s separation, and he opened up to the audience before dedicating his song "<a href="http://www.ukfitflops.com/" title="fitflop">fitflop shoes</a>" to his estranged wife. </p><br><p>It has to fall somewhere between <a href="http://www.pradaoutlet-store.com/" title="prada outlet">prada outlet</a> and sensible (granted, that's a word rarely uttered along the front rows of any runway). What's your secret to traveling in style?Here are some <a href="http://www.fitflopflip-flop.com/" title="flip flops">fitflop shoes</a> paper dolls to help you create your own <a href="http://www.coachfactoryoutlets2014.com/" title="www.coachfactory.com/store">www.coachfactory.com/store</a>. How (ahem) scandalous.We have seen <a href="http://www.fitflopsflipflops.com/" title="flip flops">fitflops</a> for several charities. Clarks Sportswear Tawyer silhouette by fitflops, we're given a couple new angles on the shoe, which is dressed up in navy and burgundy, with leather laces and a rubber;</p><br>


Your name:
Title:
Comment:
Add Comment   Cancel 

  
 Search Minimize

  
 Archive Minimize

  
 Blendblog Survey Minimize
Our next client application will be written using:




Which Tablet Do you expect to buy?





Submit Survey  View Results

 Print   
Copyright 2011 by blendblog.net   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2019 by DotNetNuke Corporation