Files
clash-verge-rev/src-tauri
Tunglies 97453a9077 perf(tray): build menu in one main-thread dispatch
Every tauri menu API call from a non-main thread blocks on a synchronous
round-trip to the app event loop. Building the tray menu with proxy
groups enabled issued one such round-trip per menu item (200+ for a
typical subscription) while holding the menu update lock, and the cost
grows when the event loop is busy with webview work.

Gather the async inputs (verge/clash/profiles snapshots and the proxy
view) on the caller's task, then construct every menu item inside a
single run_on_main_thread closure and hand the finished menu back;
set_menu and the per-group refresh keep their original call sites.
Measured on a standalone tauri bench (5 groups x 40 nodes): a rebuild
drops from ~6.2ms to ~1.6ms on an idle event loop and from ~11.4ms to
~1.6ms with the loop busy. refresh_proxy_items already used this shape;
the rebuild path now matches it.
2026-10-20 23:46:43 +08:00
..
2025-02-27 03:18:23 +08:00
2024-06-20 13:50:28 +08:00
2026-07-27 00:44:53 -07:00
2026-10-09 13:43:50 +08:00