NSStatusItem Core Animation Commit Cycle

I have a MacOS application which displays a NSStatusItem with a custom view, implemented in SwiftUI. I noticed some rather terrible performance problems, however only when I am using some specific wallpapers.

I've made a super small Xcode project demoing the behavior. In that repo, I've also linked a YouTube video demoing the behavior (can't post video link here for some reason).

With one wallpaper, Instruments Time Profile is showing little-to-no weight in any CA-related traces. However, as soon as I change the wallpaper, Instruments is reporting a huge increase in CA::Transaction::commit(). After updating the wallpaper, Core Animation commit graph in instruments is showing hundreds of commits per second. When I switch it back to the first wallpaper, it stops. Also interesting - as soon as I switch the wallpaper, Instruments Time Profiler is reporting my application to be out of "Initializing" state and now into "Foreground".

Is this a bug or something I, as a developer, can prevent? Furthermore, how would a wallpaper change the state of my application?

Interestingly enough, but I experience exactly the same issue!

I've spent literally the whole day debugging this problem. Quite a few users reported it to me. And it turns out to be nothing that I do wrong. I've managed to reproduce it exactly as you described on my app, and the problem just goes away when changing the wallpaper.

@nickdonald, have you found any solution to this? Also, have you reported a bug to Apple?

NSStatusItem Core Animation Commit Cycle
 
 
Q