Bug 351923 - High CPU usage during animations due to event filters
Summary: High CPU usage during animations due to event filters
Status: RESOLVED FIXED
Alias: None
Product: libplasma
Classification: Frameworks and Libraries
Component: libplasma (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-29 06:07 UTC by Loïc Yhuel
Modified: 2016-02-17 10:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Loïc Yhuel 2015-08-29 06:07:10 UTC
I'm still on plasma 5.3.1 (but with frameworks 5.13), and with a simple spinning animation, plasmashell uses 30% of one core.

Using perf top, I see quite a lot of samples in QCoreApplicationPrivate::sendThroughApplicationEventFilters, which is quite unexpected.
Even on an idle system, this function is at the top of the profile.

Looking with gdb, I see there are many event filters on the application :
    214 Units
     55 QQmlPrivate::QQmlElement<Plasma::Svg>
    118 Plasma::FrameSvg
     26 Plasma::Svg
     12 suspicious entries (dangling pointers ?)
      1 DialogShadows
      1 PanelShadows
      1 Plasma::ThemePrivate

I don't know if it's normal to have so many instances (perhaps there are leaks), but Plasma::Svg and Units should use a singleton as event filter, to avoid calling Units::eventFilter and Svg::eventFilter hundreds of time for each application event.

Reproducible: Always
Comment 1 Marco Martin 2015-11-19 10:27:34 UTC
the potentially two offending event filters we can controls are in Svg and Units, they filter for QApplication events.
I can try to make it filtered by a static QObject then just connecting the signals that have to be relayed, we can see if improves things
Comment 2 Marco Martin 2015-11-19 12:08:28 UTC
an attempt at it:
https://git.reviewboard.kde.org/r/126113/