Print Page | Close Window

Performance drop under SL5 runtime

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3385
Printed Date: 28-Mar-2024 at 8:04am


Topic: Performance drop under SL5 runtime
Posted By: stephenmcd1
Subject: Performance drop under SL5 runtime
Date Posted: 10-Apr-2012 at 5:00pm
We are in the process of upgrading our app to SL5 but have noticed a significant performance drop that is stopping us from moving forward.  I was able to reproduce the problem in the ' http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-silverlight-console - Simple console app ' code sample.  

To reproduce our problem, all I did was do a 'get' a bunch of entity properties (in this case, in a big loop but in our real app it's not so contrived).  It appears the DataEntityProperty.GetValue(...) method has become a major slowdown for us.  It's strange because we didn't re-target our app to SL5 or change anything else.:
private void GotCustomers(EntityQueryOperation<Customer> args) {
    _localOutput.Append(string.Format("[{0}] Retrieved {1} customers\n",
    _nameBasicQuerySyntaxQuery, args.Results.Count()));

    #region New Code
        
    var start = DateTime.UtcNow;

    //This is mostly just a dummy variable so we know that the code doesn't get optimized away
    long dummyCounter = 0;

    //Go through all customers
    foreach (var customer in args.Results)
    {
        //Loop a bunch of times so we have more accurate timings
        for(var i = 1;i<100000;i++ )
            //Access the .City property (which will eventually call DataEntityProperty.GetValue() which seem
            //   to be a lot slower now)
            dummyCounter += customer.City.Length;
    }

    //Print out the elapsed time
    var elapsed = (DateTime.UtcNow - start).TotalSeconds;
    _localOutput.AppendFormat("Silverlight Version {0} took {1} seconds", Environment.Version, elapsed);

    #endregion
        
    Utility.FlushOutputBuffer(_localOutput, _resultsReporter);
}

Running this code under the Silverlight 4 versus Silverlight 5 (same machine), I get timings like this:

Version 4.1.10111.0 took 0.3280158 seconds
and then
Version 5.0.61118.0 took 6.809666 seconds

These timings are on a 'plain' box with just the client SL runtime.  And all I did between those timings is upgrade to SL5 client runtime (no changes to the code).  In our app, we aren't seeing quite that 20x slowdown but we are seeing about a 10x slowdown and it is painful.

This is all in DevForce version 6.1.6.0.



Replies:
Posted By: DenisK
Date Posted: 11-Apr-2012 at 12:58pm
Thank you for the report stephenmcd1. Let us analyze this a bit to understand what's going on.


Posted By: kimj
Date Posted: 18-Apr-2012 at 10:45am
Hi Stephen,
 
Just to update you - we're still looking at this. We see the problem too, but don't yet have an answer for what's causing the performance hit. We don't have SL5-specific code - although we do provide natively compiled SL5 assemblies, all our Silverlight assemblies use the same code base, so it's not clear why the property GetValue logic is so much slower in the SL5 runtime.
 
We'll let you know as soon as we learn more.


Posted By: kimj
Date Posted: 23-Apr-2012 at 6:43pm
We've finally isolated the problem to the use of the generic IPropertyInterceptorArgs<TInstance, TValue> interface deep within the GetValue logic.  Although we plan to rewrite this code to fix the issue, we don't anticipate that it will be ready for the upcoming 6.1.7 release.  We'll also be filing an MS Connect bug once we've got a simple repro solution.
 
Thanks for bringing this to our attention.


Posted By: stephenmcd1
Date Posted: 23-Apr-2012 at 6:51pm
Glad to hear the mystery has been solved....or at least partially solved.  I guess we'll hold off on upgrading to SL5 for a little bit.  So do you think the fix will be in 6.1.8, then?  Any rough estimates as to when that might be?

Thanks for looking into it!


Posted By: mtodd
Date Posted: 24-Apr-2012 at 6:34am
I have been following this post and have experienced the exact same issue after upgrading to 6.1.6/SL5. It is great news to hear of the fix, and I look forward to any patch/fix when it becomes available!
 
Mitch


Posted By: kimj
Date Posted: 24-Apr-2012 at 9:12am
Once we have a fix we'll probably release it as a patch to 6.1.7.  Btw, the 6.1.7 release is scheduled for early May, so a patch would probably follow by a week or more.
 
I also want to note that the problem is not specific to the 6.1.6 release, so downgrading to an earlier DevForce release won't help.


Posted By: kimj
Date Posted: 24-Apr-2012 at 7:00pm
And another update - the developer pulled a few all-nighters and we will have the fix in the upcoming 6.1.7 release.


Posted By: stephenmcd1
Date Posted: 24-Apr-2012 at 7:28pm
That is great news!  (the part about fixing it.....not so great that it required all-nighters :-)).  We'll be looking forward to that release.  Lots of good bug fixes.

Thanks again for the great support and turnaround!



Print Page | Close Window