locked
Profiling and Improving Lightswitch Silverlight Performance RRS feed

  • Question

  • I've been following the thread on Speed optimization? because I too believe my app to be performing quite poorly. However my app is quite different than most of the apps that are experiencing problems in that thread. I have comparatively few Data Grids and those that I do have, have very few records.

    The problem area in my app consists of many AutoCompleteBoxes that are either visible or not depending on the results of queries on the database. I have yet to profile the database performance but I doubt that is the problem considering the (relatively) few records.

    However a post in the aforementioned thread by Xpert360 got me interested in the actual performance of the Silverlight portion of the application. Unfortunately the links he provided to enabling GPU acceleration were less than stellar and due to my lack of experience with Silverlight really didn't help at all.

    Through lots of Googling, I was able to find a couple of links that described the process a bit better as well as give various other ways to help profile the performance of Silverlight.

    Through reading the following posts:

    GPU Accelerated PlaneProjection

    Silverlight 3 and GPU Acceleration

    Optimizing Silverlight with Enable Redraw Regions

    I was able to figure out that by going into the default.htm file and adding 

                <param name="enableGpuAcceleration" value="true" />
                <param name="enableCacheVisualization" value="true" />
                <param name="enableFrameRateCounter" value="true" />

    or

                <param name="enableRedrawRegions" value="true" />

    The Silverlight client now gave visual indication of the unoptimized sections of the application. That is to say, pretty much all of it.

    The part I still can't figure out is how to make improvements. I know I have to go in and set the CacheMode property to BitmapCache on certain screen elements to get the GPU to accelerate them. And I know that creating sibling elements without any children in order to apply effects to smaller regions will also help minimize the redraw. What I don't know is where to do these things. I've tried messing with the Client.lsml file since that seems to be where the screen elements are put together. But I've only succeeded in creating runtime errors.

    There is something fundamental that I'm not understanding about how Lightswitch and Silverlight interact. Can anyone give me any pointers as to how to optimize the Silverlight content in my application? Like I said, I have very little experience with Silverlight so please feel free to point out things that may be obvious to someone more versed in the technology.

    Tuesday, January 8, 2013 7:55 PM

All replies

  • Hi Kyle,

    My assumption is that when using LS the intention is to help to user get an app up an running very quickly without being bogged down in the underlying platform semanitcs - kind of what you have described above.

    In reality its looking like rather than an 'IT' chap using LS to create apps you have developers doing it that need the flexiblity you have described above.

    The thing with the html client is that you bascially get all the hooks in for free, but with with the silverlight client I dont see much that you can do other than create a custom control when you need such flexibility. In day to day practise though for devs this would probably mean creating loads of controls, which is going against what LS was intended for. thanks for the tips you have pointed out here, good luck pitty I couldnt help you out more - if you're using the 3 tier approach try get some metrics at the different levels, you might be able to speed up a bit more at the other levels...

    Wednesday, January 9, 2013 2:20 PM
  • I agree that getting an app up running quickly and easily is the main goal of Lightswitch which is why I chose it as a platform. And to that effect it has worked fantastically. The app is already deployed on Azure and new features are quickly and easily added.

    The problem, as can be seen in several threads in this forum, is performance. The app I'm developing is a replacement for an aging VB6/Winforms app. One of the goals was to replicate the look to reduce retraining of the users. Which I was able to do in an astonishingly short amount of time. But the screens take ages to load versus the VB6 app in which the screens are created in a very similar fashion but are instantaneous.

    I understand that the Lightswitch team is hard at work trying to increase performance. But I simply cannot wait for the next release to come around for the performance problems to be fixed. That kind of defeats the point of being able to develop an app quickly if we have to wait for the performance to be acceptable.

    But, being a moderately skilled developer with a willingness to learn, I don't mind tinkering with the internals to get what I want. Another major tenent of Lightswitch is that while it's quick and easy to get something basic, it's also flexible and powerful enough to get anything that is desired.

    My problem is a lack of experience with Silverlight and it's particular implementation in Lightswitch. So it's probably a lack of vocabulary more than anything. I don't know what to search for to figure out how to get what I want. I'm hoping that someone on this forum can point me in the right direction.

    As a side note, you mentioned the HTML client. That is something that I defiantly want to integrate in the future to add support for tablet based interaction. I was going to wait until I became a bit more mature but it may be worth exploring sooner. Have you done much with it? How is the performance of a similarly designed screen versus the Silverlight client? What exactly do you mean by "you basically get all the hooks in for free"? I'm quite interested to hear more from people that have actually used it but I think I'll spend the afternoon reading up on how it's progressing.

    Wednesday, January 9, 2013 4:52 PM
  • Kyle,

    I'd be very careful about using the HTML Preview, at least about adding it to a current project. It changes the structure of the project quite a bit, & there's no way to "go back".

    Remember ,it's a preview, & as such should only be used in test/non-production projects. You may have already been aware of this, but I just wanted to point it out, just in case.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, January 10, 2013 1:46 AM
    Moderator
  • Absolutely right Yann. The team is very clear on this subject but it's worth mentioning again. One of the first things I read about the client has a big note warning of the changes that will be made to the project.

    From this article:

    Note

    When you add an HTML Client project to a LightSwitch solution, it’s upgraded to Microsoft LightSwitch HTML Client Preview 2 for Visual Studio 2012. The file structure of the solution is modified, and you can no longer open the solution on a computer that doesn’t have Microsoft LightSwitch HTML Client Preview 2 for Visual Studio 2012 installed.

    The part about not being able to open the solution on normal VS2012 installs makes it pretty clear that this is a one way street. But I think it is well worth it to create a test project and see the performance differences between the clients as well as how easy it is to make screens that look similar to my desired UI.

    Thursday, January 10, 2013 1:08 PM
  • Hi Kyle,

    I havent created an app with the html client, I only presume that if your app is data entry entensive ala access/excel then the silverlight client is actually the better solution for this, if there is minimal data entry and more view or presenting of data then the html client gives you way more control and you can then start using more web dvelopment speed up tricks, also, partially depending on the platform e.g. if its a mobile app then the html client would possibly be the best option.

    My problem is a lack of experience with Silverlight and it's particular implementation in Lightswitch. So it's probably a lack of vocabulary more than anything. I don't know what to search for to figure out how to get what I want. I'm hoping that someone on this forum can point me in the right direction.

    I think most of us are in the same boat...

    Thursday, January 10, 2013 4:01 PM
  • "I think most of us are in the same boat"

    Before starting to use LightSwitch, I had zero experience with Silverlight (but a little with WPF, so that helped).


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Friday, January 11, 2013 4:39 AM
    Moderator
  • Hi Yann,

    I think its a safe bet that 99% of the day to day silverlight dev wouldnt use LS,( in practicality it wouldnt make sense so thats a bit of a harsh comment though I dont mean it to sound that way), by the way the forum urls in all have chinese locae appended (zh-hk) for me(no other sites are picking this up from my browser so I think it is a ms issue?)

    Friday, January 11, 2013 9:36 AM
  • same thing with my UK msdn rss - just slew of non english blog posts came through this afternoon including german posts! must be something odd with ms locality stuff today!


    Friday, January 11, 2013 5:55 PM