New Posts New Posts RSS Feed: Performance drop under SL5 runtime
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Forum LockedPerformance drop under SL5 runtime

 Post Reply Post Reply
Author
stephenmcd1 View Drop Down
DevForce MVP
DevForce MVP


Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
Post Options Post Options   Quote stephenmcd1 Quote  Post ReplyReply Direct Link To This Post Topic: Performance drop under SL5 runtime
    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 '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.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1390
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1390
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
stephenmcd1 View Drop Down
DevForce MVP
DevForce MVP


Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
Post Options Post Options   Quote stephenmcd1 Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
mtodd View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Feb-2011
Location: Ann Arbor, MI
Posts: 1
Post Options Post Options   Quote mtodd Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1390
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1390
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
stephenmcd1 View Drop Down
DevForce MVP
DevForce MVP


Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
Post Options Post Options   Quote stephenmcd1 Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down