Increase animation rate on Apple MacOS

Hi,

I experience slow animation rate with Gtk±3.0 on Apple MacOS Big Sur. This happens especially when focused and maximized window.

As put another application in front, the animation in the background is fluent.

My idea was I am missing some config value in Info.plist, but wasn’t able to fix it, yet.

The DMG binary is available here:


The audio threads are fine, but Gtk±3.0 seems to have some performance penalties.

1 Like

For reference I asked on Apple forums, too.

Apple developer forums

First off, the performance rate of GTK 3 on macOS is terrible for a number of reasons. It uses cairo-quartz which is already not-great in terms of speed. On top of that if you’re using client-side-decorations at all, you are incurring a very expensive blend operation by the compositor because the window region is treated as non-opaque (GTK 4 does fix this when using Cairo).

Furthermore, if you have a modern mac chances are you have HiDPI too. The amount of pixels to push to the screen on every frame is usually just too much.

When you put the window into the background, you start to obscure things, which allows the compositor to clip more aggressively on what it damages during composite. So chances are you are just seeing less drawing happen on each frame, both by the app and the compositor.

If you want to verify this, try using Quartz Debug tool and turn on things like Opaque region highlighting and flash updates.

If you take the time to read the GTK source code, you’ll notice that it does set foreground application status.

https://gitlab.gnome.org/GNOME/gtk/-/blob/b933d576322b716ede78a89b97189c4198437286/gdk/quartz/gdkdisplay-quartz.c#L614

Hi @chergert

Thank you for your response. Yes, the situation is actually quiet bad, CPU load is at least 100%.

I have got a work-around by setting some defaults of GtkSettings:

This gives me small improvements:

g_object_set(gtk_settings_get_default(),
	 "gtk-cursor-blink", FALSE,
	 "gtk-enable-accels", FALSE,
	 "gtk-enable-mnemonics", FALSE,
	 "gtk-enable-animations", FALSE,
	 "gtk-enable-event-sounds", FALSE,
	 "gtk-enable-input-feedback-sounds", FALSE,
	 "gtk-enable-tooltips", FALSE,
	 "gtk-error-bell", FALSE,
	 NULL);

After looking for some timeouts in Gdk, I have found this:

https://gitlab.gnome.org/GNOME/gtk/-/blob/b933d576322b716ede78a89b97189c4198437286/gdk/quartz/gdkwindow-quartz.c#L228

Would be interesting what compatibility uses MacPorts …

Well, migrating to Gtk4 seems to be more attractive than ever.

regards,
Joël

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.