Bug 351923

Summary: High CPU usage during animations due to event filters
Product: [Frameworks and Libraries] libplasma Reporter: Loïc Yhuel <loic.yhuel>
Component: libplasmaAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: normal CC: kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

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/