perf: Don't poll every second for kevents#6452
Conversation
|
Instead of keeping to patch VDKQueue, maybe consider replacing it with libtransmission/watchdir-kqueue.cc? The two provide essentially duplicate functionality but we're using libtr implementation in the daemon anyway and it's not going away. I wouldn't suggest it if the needed functionality was provided by the SDK (as is the case with Qt and GTK) and we weren't reinventing the wheel... Granted, I didn't look at how easy it'll be to use so won't insist. |
3e510a3 to
7b2ce2c
Compare
Current solution works pretty well and is the underlying mechanism used by GCD (Obj-C) and DispatchSource (Swift), so I don't see any need to take the risk to change it at the moment. Let's prioritize moving Transmission to Swift instead. |
|
In fact, FSEvents also uses kqueue under the hood. (If you ever misuse FSEvents you'll see some kqueue error messages scroll past your console!) |
7b2ce2c to
b705182
Compare
Fix bdkjones/VDKQueue#22.
Instead of polling
keventevery second, we remove thetimeoutand we send a one-shot event when we want to stop watching.Testing: with DEBUG_LOG_THREAD_LIFETIME enabled, I can see "watcherThread finished." instantly after turning off the "Watch for torrent files" option in the Transmission settings.
Notes: Improved macOS UI code to use less CPU.