[callgrind] compiz spends ~25% of its time constructing/destructing strings in PrivateScreen::handleActionEvent

Bug #1005569 reported by Sam Spilsbury
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Compiz
Fix Released
High
Daniel van Vugt
Compiz Core
Fix Released
High
Łukasz Zemczak
compiz (Ubuntu)
Fix Released
High
Unassigned
Precise
Fix Released
High
Unassigned

Bug Description

[Test Case]
Performance improvement, no obvious test case possible. Check for visible regressions.

[Regression Potential]
Compiz options (like for plugins) stop working

Original description:

Callgrind reports that CompOption::setName (and hence about 37,000,000 calls to malloc) is being called necessarily, mostly all from handleActionEvent.

Related branches

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Callgrind says this accounts for about 5% of "self" time. (Which was the second highest after the glib mainloop dispatch ... for some reason)

Changed in compiz:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Sam Spilsbury (smspillaz)
milestone: none → 0.9.8.0
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: [callgrind] compiz spends ~17% of its time constructing strings in PrivateScreen::handleActionEvent

Profiling compiz, I find it's spending 17% of its time constructing strings in PrivateScreen::handleActionEvent. All for CompOption::setName it seems.

summary: - [callgrind] CompOption::setName called 2,000,000 times while not
- actually doing anything related to it
+ [callgrind] compiz spends ~17% of its time constructing strings in
+ PrivateScreen::handleActionEvent
Changed in compiz:
importance: Medium → High
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

That's 17% inclusive time, which means "self" time plus everything that happens within the basic_string constructor.

Changed in compiz-core:
status: New → Triaged
importance: Undecided → High
Changed in compiz:
status: Confirmed → Triaged
Changed in compiz (Ubuntu):
status: New → Triaged
importance: Undecided → High
summary: - [callgrind] compiz spends ~17% of its time constructing strings in
- PrivateScreen::handleActionEvent
+ [callgrind] compiz spends ~25% of its time constructing/destructing
+ strings in PrivateScreen::handleActionEvent
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Including destruction of the strings, the total goes up to about 25% of compiz' time.

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

Fix committed into lp:compiz at revision 3236

Changed in compiz:
status: Triaged → Fix Committed
assignee: Sam Spilsbury (smspillaz) → Daniel van Vugt (vanvugt)
Changed in compiz-core:
milestone: none → 0.9.7.10
Revision history for this message
Sebastien Bacher (seb128) wrote :

Daniel says that we "only need r3237 for the string performance fix"

Changed in compiz (Ubuntu Precise):
status: New → Triaged
importance: Undecided → High
milestone: none → ubuntu-12.04.1
Changed in compiz-core:
status: Triaged → In Progress
assignee: nobody → Łukasz Zemczak (sil2100)
description: updated
Changed in compiz (Ubuntu):
status: Triaged → In Progress
Changed in compiz (Ubuntu Precise):
status: Triaged → In Progress
Changed in compiz-core:
status: In Progress → Fix Committed
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Fix committed into lp:compiz-core/0.9.7 at revision 3106

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Sam, or anyone else affected,

Accepted compiz into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/compiz/1:0.9.7.8-0ubuntu1.1 in a few hours and then in the -proposed repository. Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case details of your testing will help us make a better decision. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in compiz (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (7.6 KiB)

This bug was fixed in the package compiz - 1:0.9.8+bzr3249-0ubuntu1

---------------
compiz (1:0.9.8+bzr3249-0ubuntu1) quantal-proposed; urgency=low

  * New upstream snapshot.
    - Fall back to a refresh rate that is more likely to look correct; 60Hz.
      (LP: #1009338)
    - Benchmark plugin should consume its key binding, and not pass the key to
      the underlying window. (LP: #1009320)
    - Avoid needless STL operations leading to expensive heap operations.
      (LP: #1006335)
    - Fix a typo that was causing (LP: #1002606)
      (widthIncBorders/heightIncBorders)
    - Check if the window is decorated before trying to change its event window
      states (which won't exist if not decorated) (LP: #1007754)
    - Use the XDamage extension more efficiently (the way it was designed to be
      used). This dramatically reduces CPU usage, reduces wakeups, and
      increases frame rates. It also solves at least one observed performance
      bug (LP: #1007299) and probably several more.
    - Avoid constructing and destructing lots of strings on every single event,
      which was wasting lots of CPU (LP: #1005569)
    - md LINGUAS doesn't exist, it's mnk (Mandinka in ISO 639-3)
    - Move grid plugin to google test and don't depend on the plugin for the
      test (LP: #1005009)
    - Don't read plugin.Initialized and test the value. (LP: #1004848)
    - libcompizconfig's install () commands were still using the old includedir
      and libdir variables rather than their libcompizconfig_* variants.
      (LP: #1005176)
    - Execute the cmake files separately to ensure that DESTDIR is respected.
      (LP: #1005177)
    - Don't set_target_properties on a target that might not exist
      (LP: #1005008)
    - Don't allow windows which we weren't even tracking as decoratable to
      become decorated if they try and change their hints. (LP: #963794)
    - Change the mouse pointer while dragging windows in expo. Just like the
      ubuntu branches do. (LP: #987647)
    - Fix uninitialized memory use (LP: #1004338)
    - Fix uninitialized variable (LP: #1004335)
    - Delay unbinding of pixmaps until then next rebind (LP: #729979)
      (LP: #1002602)
    - Don't drop plugins from the list to try and load before you've even tried
      to load them. Doing so makes missing plugins silently ignored instead of
      an error message (LP: #1002715). It also means valid plugins in more
      unusual, but real locations in LD_LIBRARY_PATH will never get loaded
      (LP: #1002721).
    - If running test cases under a real X server, we don't care if Xvfb is
      missing (LP: #994841)
    - Don't assume pkg_check_modules always sets _PREFIX (LP: #993608)
    - Don't clear selections in ~PrivateScreen because it causes a race between
      the existing and the new compiz instances, breaking --replace and
      non-replace behaviour. (LP: #988684) (LP: #989545)
    - Always paint with infiniteRegion as the clip region if the window is
      transformed and always use the supplied region if painting with offset or
      on transformed screen. (LP: #987639)
    - Add synchronization primitives to the decoration protocol so that there
      isn't a r...

Read more...

Changed in compiz (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Soumyadeep Chanda (deep-fatality) wrote :

Now compiz idles at 45% cpu usage, nvidia binary blog here.

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

Didn't notice any regressions on Intel Ironlake Mobile w/ i3 M 330 CPU laptop.

Revision history for this message
Vadim Peretokin (vperetokin) wrote :

No regressions on GeForce GTX 560/PCIe/SSE2 w/ i5-2500K either.

Revision history for this message
Soumyadeep Chanda (deep-fatality) wrote :

i'm on geforce 8200m w/ amd 64 x2(1.9 x 2 ghz), even mouse movements cause cpu usage to go up

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

I think you will find the biggest compiz CPU problems will be fixed with:
    bug 1007299
    bug 988079

Revision history for this message
Miklos Juhasz (mjuhasz) wrote :

No regression on Intel i7 with the integrated VGA card. Also tested an ATI card using the radeon driver, works fine.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package compiz - 1:0.9.7.8-0ubuntu1.1

---------------
compiz (1:0.9.7.8-0ubuntu1.1) precise-proposed; urgency=low

  [ Łukasz 'sil2100' Zemczak ]
  * Cherry-pick upstream patches:
    - CMake Error at FindCompiz.cmake:84 (include): include could not find load
      file: CompizDefaults (LP: #993608)
    - compiz (decor) - Warn: failed to bind pixmap to texture (LP: #929989)
    - gtk-window-decorator crashed with SIGFPE in
      _decor_blend_horz_border_picture() (LP: #963794)
    - [callgrind] compiz spends ~25% of its time constructing/destructing
      strings in PrivateScreen::handleActionEvent (LP: #1005569)
    - gtk-window-decorator crashed with SIGSEGV in meta_get_decoration_geometry
      (LP: #1007754)
    - composite refresh rate falls back to 50Hz, which is wrong in most cases
      (LP: #1009338)
    - [callgrind] compiz spends ~7% of its time inserting into and destructing
      the events list in PrivateScreen::processEvents() (LP: #1006335)

  [ Didier Roche ]
  * debian/control:
    - change Vcs-Bzr to point to precise branches
 -- Lukasz 'sil2100' Zemczak <email address hidden> Wed, 20 Jun 2012 15:02:31 +0100

Changed in compiz (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote :

Hello Sam, or anyone else affected,

Accepted compiz into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/compiz/1:0.9.7.8-0ubuntu1.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
Miklos Juhasz (mjuhasz) wrote :

The proposed package works fine. Tested on Intel i7 with the integrated vga card, on an nVidia card with the binary blob and on a MacBookPro 8,2 with both the integrated Intel i7 card and the discrete ATI card using the radeon driver.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Adam Conrad (adconrad) wrote :

Hello Sam, or anyone else affected,

Accepted compiz into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/compiz/1:0.9.7.8-0ubuntu1.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
Miklos Juhasz (mjuhasz) wrote :

The latest proposed version also works fine, no visible regression found.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Changed in compiz:
status: Fix Committed → Fix Released
Changed in compiz-core:
status: Fix Committed → Fix Released
Changed in compiz-core:
status: Fix Released → Fix Committed
Changed in compiz-core:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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