1

Closed

Crippling Performance Issue on WP7 when using Google Analytics and a Panorama

description

I've discovered a massive performance issue with WP7 and Google Analytics, and I've managed to reproduce it. It brings the frame rate of the application down into the jerky and horrible range unfortunately.
 
The problem is that Google Analytics places an Image control inside the Panel control that WebAnalyticsService creates. It uses this Image control to load the Google Analytics URLs and the returned image is a 1x1 transparent gif pixel image. Unfortunately, putting this Image in that Panel control destroys the performance of the app on panorama pages. This does not exhibit itself on the emulator; one needs to use a hardware phone to see it (I'm testing on an LG Optimus 7G at the moment). I've attached a test project that reproduces this performance issue without using MSAF at all; it just puts a transparent pixel GIF Image control inside a Panel.
 
For some reason, I can't find the code for Google.Analytics.dll in the codebase for this project, so I can't submit a patch that fixes this issue. However, the solution is to convert the use of the Image control inside the GoogleAnalytics class to code using HttpWebRequest instead. To do this:
 
Change the UpdateImage method to this:
 
private void UpdateImage(AnalyticsEventArgs e)
{
this.UpdateSession(e.AnalyticsEvent.Timestamp);
Uri url = this.BuildUrl(e.AnalyticsEvent);
 
try
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    request.BeginGetResponse(result =>
    {
        try
        {
            HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
        }
        catch (Exception ex)
        {
            OnImageFailed(ex);
        }

    }, null);
}
catch (Exception ex)
{
    OnImageFailed(ex);
}
}
 
And change the empty OnImageFailed method to this:
 
private void OnImageFailed(Exception e)
{
}
 
I want to make these changes and use them in my project, however, I am unsure as to the licensing of the Google.Analytics.dll, since for some reason you aren't providing the source code for it. I'm hesitant to decompile it, apply my changes to it and use that class instead for fear of breaking some unnamed licence. Am I allowed to do this until you get a fix out for this issue?

file attachments

Closed May 12, 2011 at 7:08 PM by mscherotter

comments

mscherotter wrote Apr 6, 2011 at 3:08 PM

Thanks for the suggestion - I can make the fix in the code and release an updated Google.Analytics.dll.

wrote Apr 6, 2011 at 4:23 PM

wrote Apr 6, 2011 at 4:45 PM

mscherotter wrote Apr 6, 2011 at 4:45 PM

Please test this updated DLL.

dchambers wrote Apr 7, 2011 at 12:30 AM

The DLL works fine, and doesn't cause the performance issue.

Just to clear things up, does this mean that DLL isn't under Ms-PL? If so, what licence is it under instead? Proprietary but re-distributable?

Thanks for fixing this so promptly Michael; I really appreciate your effort. :)

mscherotter wrote Apr 7, 2011 at 6:46 AM

The vendor assemblies are provided in the framework installer as a convenience. The assemblies provided with the framework are redistributable as is - you can read the license and include the assemblies with your application. The entire framework is released under the MS-PL license but the analytics vendors have chosen not to share the source code (though you have found that non-obfuscated assemblies can be easily decompiled and rebuilt). I hope this clears things up.

dchambers wrote Apr 7, 2011 at 7:07 AM

Okay, so the assemblies are covered by the Ms-PL, even though the source code hasn't been made available. Thanks Michael!

wrote May 12, 2011 at 7:08 PM

BrainFocker wrote Aug 25, 2011 at 8:10 AM

Attached dll degrade performance not so drastically, but still have issue

wrote Feb 21, 2013 at 11:53 PM

wrote May 16, 2013 at 11:10 AM