Reduce freezes due to RPC calls #655
Replies: 9 comments 21 replies
-
@nikitabobko: note my comment about debouncing refreshSession having some small bugs in it. if you can get it working, that is great! overall, I don't think solely debouncing refreshSession will be enough to stop hangs: if any app misbehaves, you will eat the 1s timeout (per app) and that is already too much delay. PS: iiuc, refreshSession is idempotent if no body is passed in, but when a body is passed in, then it is executing code that has side effects.
if you can re-parent comments from #131 here, that would be great |
Beta Was this translation helpful? Give feedback.
-
fyi @raisjn (and anyone else who may be experiencing this issue)
on |
Beta Was this translation helpful? Give feedback.
-
I'd love to try your build! Stupid question, but what would the step by step look like to install the forked version? I normally get it from homebrew. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your excellent work! While the original version is slow to the point of being unusable, |
Beta Was this translation helpful? Give feedback.
-
@raisjn Thank you for your solution. Just make sure I understand it correctly: the version installed from Homebrew does not have your implementation, and I have to install it from your forked repo with |
Beta Was this translation helpful? Give feedback.
-
Just wanted to report that I've been running |
Beta Was this translation helpful? Give feedback.
-
Any estimate on when/if this will be merged to main? I could really use it, but I don't want to mess with my current installation. |
Beta Was this translation helpful? Give feedback.
-
@raisjn would it be possible to update your branch to include latest changes from the main repo? |
Beta Was this translation helpful? Give feedback.
-
📢 It doesn’t seem like it’s ever going to be fixed, so I decided to start working on my own virtual workspace manager focused only on switching workspaces without tiling. After a few hours, I finished an MVP, which you can check out here: https://github.com/wojciech-kulik/FlashSpace
|
Beta Was this translation helpful? Give feedback.
-
Running into slow Aerospace?
EDIT: 12/05: ported perf patch to latest origin/main branch
Try out this branch.
Usage
Recompile the debug or release build and add the following lines to your aerospace.toml:
@liamaharon suggests the following may have better results:
What it does:
new-window-detection-timeout
is how long to block the main thread (up to X ms), whilenew-window-detection-debounce
will coalesce calls within X ms together.How it works
The root cause of slowness is that Aerospace iterates over windows and uses accessibility APIs to communicate with each app. If any application is slow to respond, it blocks Aerospace's main thread from executing. To prevent Aerospace from hanging, we put the communication with apps into a new thread.
Details
detectNewWindowsAndAttachThemToWorkspaces
calls into a debouncer and a separate queue when called from refreshSession and wait for up to X ms for it to complete.validateStillPopups
is behind a similar debouncer + dispatch queue.Note: Thread safety: for detectNewWindowsAndAttachThemToWorkspace to be threadsafe, MacWindow.get() has an NSLock placed in it so that multiple threads can access it safely. Additionally, specific work within MacWindow.get() should be moved to the main thread using a DispatchQueue
Observed Bugs:
Bug A: Starting a popup window and dragging it across monitors doesn't work (for example, System Settings). The window will get stuck on a single monitor and keep hopping back. Dragging the window within a single monitor works fine. It is possible to move the window via keyboard shortcuts, though. (I think this happens on all approaches? I haven't tested stock Aerospace)
Bug B: Focus follows mouse (AutoRaise application) doesn't play well with aerospace and multiple monitors. Switching the workspace on one monitor (monitor 1), then moving to another monitor (monitor 2) with the mouse will often cause the workspace on monitor 1 to switch back to the previous workspace. (I think this happens on all approaches? I haven't tested stock Aerospace)
FAQ
Beta Was this translation helpful? Give feedback.
All reactions