Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000283MPfmUI | Windows | Main Windowpublic2012-02-07 17:012012-02-08 16:48
Reporterycastonguay 
Assigned Toycastonguay 
PriorityimmediateSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version0.5.1.0 
Target Version0.5.2.0Fixed in Version0.5.2.0 
Summary0000283: The CPU usage is way too high when updating the UI with the current song position
DescriptionI'm not sure starting which version the CPU usage has gone quite high, but it seems to be around 0.5.1.0.

It is especially worse with 0.5.2.0. It is related to updating the UI with song position information. The label update seem to eat quite a lot of CPU.

The update timer interval can be changed from 10ms to a higher value, but that would be at the cost of having really smooth rendering.
TagsNo tags attached.
Attached Files

- Relationships
related to 0000284resolvedycastonguay Cache font objects in every control 

-  Notes
(0000401)
ycastonguay (administrator)
2012-02-07 18:13

After some testing with the label rendering, it seems that calling the OnPaintBackground event is what eats a lot of CPU, especially when the background is set as transparent.

In fact, filling a rectangle with a gradient linear brush has no impact on the CPU. I guess it might be a bug with the OnPaintBackground event or something.

No visible performance hit for anti-aliasing and embedded fonts.

So, transparent background is fine unless the label is updated very often (i.e. every 10 ms). The solution is to add a gradient backgrounds to the Label class (and also keep transparent backgrounds) and assign that to to the song position label in the main form.
(0000403)
svn (developer)
2012-02-07 21:19

The user admin has checked in files related to this issue (revision 295).

Comment:
MPfm 0.5.2.0
- Label: Added background gradient option to save CPU (instead of using transparent background).
- Reactivated background update library process for testing (now that the Label bug has been fixed).
- Added 1.03 to 1.04 script (will need to be modified later).

Related to issue 0000273 and issue 0000283.

Files modified:
U MPfm/branches/current/MPfm/frmMain.Designer.cs
U MPfm/branches/current/MPfm/frmMain.cs
U MPfm/branches/current/MPfm/frmMain.resx
U MPfm/branches/current/MPfm.Library/Library.cs
U MPfm/branches/current/MPfm.Library/MPfm.Library.csproj
A MPfm/branches/current/MPfm.Library/Scripts/1.03-1.04.sql
U MPfm/branches/current/MPfm.WindowsControls/Labels/Label.cs

(0000404)
ycastonguay (administrator)
2012-02-08 16:47

There are still many things to optimize, but for now, replacing the transparent background of the often updated labels by a gradient background has reduced the CPU usage quite a bit. It is now quite acceptable.

- Issue History
Date Modified Username Field Change
2012-02-07 17:01 ycastonguay New Issue
2012-02-07 17:01 ycastonguay Status new => assigned
2012-02-07 17:01 ycastonguay Assigned To => ycastonguay
2012-02-07 18:10 ycastonguay Target Version 0.5.2.1 => 0.5.2.0
2012-02-07 18:13 ycastonguay Note Added: 0000401
2012-02-07 18:13 ycastonguay Description Updated View Revisions
2012-02-07 19:29 ycastonguay Relationship added related to 0000284
2012-02-07 21:19 svn Checkin
2012-02-07 21:19 svn Note Added: 0000403
2012-02-08 16:47 ycastonguay Note Added: 0000404
2012-02-08 16:47 ycastonguay Status assigned => resolved
2012-02-08 16:47 ycastonguay Fixed in Version => 0.5.2.0
2012-02-08 16:47 ycastonguay Resolution open => fixed
2012-04-17 19:07 ycastonguay Category Main Form => Main Window
2012-04-17 19:09 ycastonguay Category Main Window => Window - Main
2012-04-21 09:57 ycastonguay Category Window - Main => UI - Windows - Main Window
2012-04-22 10:10 ycastonguay Category UI - Windows - Main Window => UI | Windows | Main Window


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker