Unity is wasting CPU repeatedly reloading some icons on every redraw in SimpleLauncherIcon::GetTextureForSize

Bug #822157 reported by Daniel van Vugt
26
This bug affects 20 people
Affects Status Importance Assigned to Milestone
Unity
Fix Released
Undecided
Daniel van Vugt
unity (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When profiling compiz/unity (during pulse animations) I noticed LauncherIcon::ColorForIcon was almost the single most expensive function (after malloc and free) in the compiz process. This didn't look right so I added some debug messages and found that it was SimpleLauncherIcon::GetTextureForSize repeatedly reloading (and reprocessing) some icons from scratch on every single redraw.

The cause is pretty obvious in SimpleLauncherIcon::GetTextureForSize. It assumes the loaded icon size is always exactly that of the desired icon size for the launcher. Obviously for most fixed sized icons this won't be true. So it reloads and reprocesses those icons on EVERY frame when redrawing the launcher.

Fixing the simple logic error in SimpleLauncherIcon::GetTextureForSize I found I could reduce compiz/unity CPU usage during animations (when the launcher is constantly redrawing) by up to 50%. And even a constant 25% improvement on my regular idle desktop. So definitely worth fixing.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: unity 3.8.16-0ubuntu1~natty1
ProcVersionSignature: Ubuntu 2.6.38-10.46-generic 2.6.38.7
Uname: Linux 2.6.38-10-generic x86_64
NonfreeKernelModules: fglrx
Architecture: amd64
CompizPlugins: [core,bailer,detection,composite,opengl,compiztoolbox,decor,vpswitch,place,imgpng,regex,unitymtgrabhandles,grid,session,snap,mousepoll,resize,move,animation,expo,ezoom,workarounds,resizeinfo,wall,staticswitcher,fade,scale,unityshell]
Date: Sun Aug 7 12:59:41 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
ProcEnviron:
 LANGUAGE=en_AU:en
 LANG=en_AU.UTF-8
 SHELL=/bin/bash
SourcePackage: unity
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It seems a fix has already been committed to unity 4.x without a bug number:
http://bazaar.launchpad.net/~unity-team/unity/trunk/revision/1296#plugins/unityshell/src/SimpleLauncherIcon.cpp

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

A fix was released already in unity 4.4.0

Changed in unity:
status: New → Fix Released
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Found the fix already released for oneiric: 4.4.0-0ubuntu1

Changed in unity (Ubuntu):
status: New → Fix Released
Changed in unity:
assignee: nobody → Daniel van Vugt (vanvugt)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix Committed to unity (3.0): http://bazaar.launchpad.net/~unity-team/unity/branch-3.0/revision/1209

This means the fix should appear in the next natty-update for unity - 3.8.18:
https://launchpad.net/unity/+milestone/3.8.18

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.