[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: A simple GtkSpinner is very costly in CPU cycles
From:       Emmanuele Bassi <ebassi () gmail ! com>
Date:       2018-03-21 9:17:17
Message-ID: CALnHYQH_wN9ZbQyDc1dtMo1VyVSX08f2pBPuFUPm9Mht+oU+iQ () mail ! gmail ! com
[Download RAW message or body]

On 20 March 2018 at 14:06, Kian Karas <kian.karas.dev@gmail.com> wrote:

> Hi smart people
>
> I just introduced animation, in the form of a GtkSpinner, to my application
> for the first time. When the spinner is animating, the application takes up
> 45 % of the CPU resources (the application is otherwise idle at 0-2,6 %).
> The CPU is a single core ARM Cortex-A7 running at 528 MHz (maximum).
>
> This seems like a lot of MIPS for rotating an image of approximately 20x20
> px.
>
>
The rotation is performed through CSS, in order to be stylable by themes;
this means that the CSS state has to be invalidated in order to recompute
the next frame, and this is there the cost lies.

Of course, 45% is a pretty big chunk of a core, so it's indeed problematic
on single core, low performance devices. It's going to be the case for
every animation involving CSS, though, so you may elect to either disable
animations on your platform, or use a static placeholder image. There's
also the option of using a theme that does not have as many states for the
spinner animation, thus causing fewer invalidations.

We are actively working to fix the issue on GTK 4, but changing the CSS
subsystem has the potential of breaking GTK 3 applications, so it's not on
the roadmap, outside of low impact optimizations.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic