CPU usage

Feb 3, 2012 at 4:08 PM

Hello again -

One last issue and I think I'm all set. I noticed that CPU usage spikes while a document is being displayed. Once the document loads, Windows task manager reports up to 50% CPU usage on a laptop i5 processor and it doesn't let up until I close the application. On IE this doesn't seem to impair usage of the app, but on Firefox it becomes very laggy.

If I set the visibility of the control to Collapsed then the CPU usage drops off entirely, so it seems to be specifically while a document is being rendered. Changing the scaling of the document does not appear to have any impact. I'm wondering if you have any thoughts on why the CPU usage is so constant? Some notes:

  • Firefox 10
  • IE 8
  • Silverlight 4
  • It's a one-page XPS that was generated from an Excel document
  • I pre-download the document in its entirety and then feed the stream to a default package reader

I'm wondering if you've observed symptoms of this issue before and have any ideas on where I can start looking. Thanks!

Coordinator
Feb 3, 2012 at 4:41 PM

Hi,

The CPU usage may go up while loading and displaying a page, but shouldn't take 50% CPU usage for longer periods of time. Could you share this document so I can see if I can reproduce (including any steps required to reproduce)? You may send it to the email adress listed on http://firstfloorsoftware.com/contact, if you do not want to share it publicly.

- Koen

Feb 3, 2012 at 6:37 PM

I just put it into a standalone project and can't reproduce it in that situation. It must be the interaction with other parts of the app layout. If I can reproduce in my standalone version and/or if I find the source of the spike from elsewhere I will let you know. Thanks!

Feb 3, 2012 at 7:46 PM

Found it - one of the parent containers in the full app had a drop shadow that was killing the CPU. I removed it and it's down to 1-2% CPU while "idle" as opposed to the 50% I was seeing before. In case it benefits others, this article describes the issue:

http://blogs.catapultsystems.com/asills/archive/2010/12/20/performance-degradation-using-drop-shadows-in-silverlight.aspx

Thanks again for your time. By the way, Silverlight Spy really rocks too - already saved me a bunch of time. I'll be getting a license for that too for sure!

Coordinator
Feb 3, 2012 at 8:59 PM

Ah yes, software rendered pixel shaders have a disastrous effect on performance. Kudos for finding and sharing. Much appreciated.

- Koen

Feb 8, 2012 at 2:40 PM

We've just run in to exactly the same problem and we use the Document Toolkit as a widget inside a web application. Removing drop shadows has improved performance but we are still running at some like 50% of the processor.

Could the document toolkit viewer be forcing the parent application to redraw even when there is no change?

Coordinator
Feb 8, 2012 at 2:44 PM

Document Toolkit does not enforce redraws. CPU usage may peak during loading and initial rendering, but that shouldn't take a longer period of time. Did you remove all effects?

- Koen

Feb 8, 2012 at 3:24 PM

The only effects in use were drop shadows and I have commented all of those out in order to resolve this issue.

The very second I close our document viewer widget the CPU returns to 1-4% usage and it happens with no other widgets.

Coordinator
Feb 8, 2012 at 3:25 PM

Does this behavior occur with specific documents, or does it occur with any document? 

Feb 8, 2012 at 3:40 PM

It appears to occur with any document but it is worse with more complex or larger documents.

The only other thing that appears to affect the CPU usage is the actual amount of the screen taken up by the viewer.

Coordinator
Feb 8, 2012 at 4:03 PM

I'm still clueless. Can you isolate the viewer widget and run it in a standalone app? Just to make sure the problem is with the widget?

- Koen