-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: improves performance of ThumbnailPanel significantly #87
Conversation
One performance issue we had is related how layers are handled. This commit allows subviews of Cell to be drawn into its layer and the layer be drawn asynchronously. In my test use-case with 16 windows with 3440x1417 sizing this brought the required time from key event reaction to ThumbnailPanel orderOut from 650ms down to 250ms. There is eventually more performance to gain by explicit control of .layerContentsRedrawPolicy. This commit also adds two NSLog statements for easy timing observations in the Run console. Related to lwouis#45
Btw. the first panel summon takes a little longer. Subsequent summons are improved greatly on my system. |
This only improves #45 Interesting documentation about layers: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreAnimation_guide/SettingUpLayerObjects/SettingUpLayerObjects.html |
I checked out the code, then removed the 2 layer lines and tested locally with like 50 finder windows: 1s to 1.1s. I then put back the 2 layer lines: 1s to 1.1s. Basically I see no performance improvements with or without this PR :/ Looking in Instruments again, I see most of the time being spent in I'm confused about how the layer situation is taking time on your machine Update: actually in Instruments, the total time is 250ms, not the full 1s that it actually takes. And indeed when I comment out the |
Dammit. Made the same observation on my MacBook running the latest macOS, it makes no difference. My home computer is using an desktop cpu and running on nvidia drivers and also using an older macOS version (high sierra). No idea what of that is causing a difference there. Need to invest more time into this. Thank you for checking it out and testing and profiling it. I also need to find a better lifecycle method (other than orderOut) cause visually it feels like the NSLog statement in orderOut() appears later in the console than the view actually disappearing. The console could be also running on a different thread and be a little off/async. |
Yes, basically I think we haven't really diagnosed the performance bottleneck correctly yet. First step should be to find a way to actually diagnose. I don't know why Instruments is not helping here :/ |
Yeah instruments/profiler does not show the full story or i don't interpret it correctly and thats why i added the NSLog statements. I did not check |
Calls to |
Maybe the This seems to go in the direction discussed by @galli-leo here. I guess in my previous inspections I focused on the time in the A last note: I tested HyperSwitch, and they display instantly my 50 finder windows. I tried having a video running and I see that they don't refresh the thumbnails on every alt-tab, so I guess they don't have the issue because they render the thumbnails in the background all the time in advance, and update periodically. |
All AX API calls are expensive (and slow) as they are serialized requests. If one application takes a long time to respond, this will delay every other request to different applications even if you are doing them through multiple threads. If all you care about is getting the current dimensions of the window, you can use the following private API call (located in SkyLight.framework).
|
I'm closing this PR as its improvements are unclear, and anyway I have significantly improved performance in an upcoming PR when I changed pretty much every OS call. See #14 (comment) |
One performance issue we had is related how layers are handled. This commit allows subviews of Cell to be drawn into its layer and the layer be drawn asynchronously. In my test use-case with 16 windows with 3440x1417 sizing this brought the required time from key event reaction to ThumbnailPanel orderOut from 650ms down to 250ms. There is eventually more performance to gain by explicit control of .layerContentsRedrawPolicy. This commit also adds two NSLog statements for easy timing observations in the Run console.
Related to #45 (closes?)