Repository navigation
TimeSync 0.1.5 — drop popover-closed CPU from 10% to ~1%
Performance fix. Anyone running v0.1.4 (or any earlier version) was burning ~10% CPU continuously, even with the popover closed. v0.1.5 brings that down to ~1% baseline.
Root cause
MenuBarContent had a 10 Hz Timer.publish(every: 0.1) autoconnected at view-construction time. With .menuBarExtraStyle(.window) (which we use for the popover), the SwiftUI view tree stays mounted even when the popover isn't visible — so the timer kept firing 10 times per second forever, forcing a full re-evaluation of the popover body each tick (re-resolving SF Symbol glyphs, recomputing format strings, the works).
The 10 Hz rate is there to render the .SSS millisecond field on the UTC clock display in the popover header. Useful when you're looking at it; pointless when you aren't.
What changed
- The timer now lives behind
.onAppear/.onDisappear. It only ticks while the popover is actually visible. Verified withps -o %cpusampling: post-launch with the popover never opened, three 5-second windows read 4.7% → 1.3% → 1.1%. The residual ~1% is the legitimateChronyMonitorpoll (every 5 s) + gpsd TCP stream — not the timer. formatUTC()no longer allocates a freshDateFormatteron every call — the formatter is now astatic let, created once per process.
Both fixes are pure source-side. The notarized binary in v0.1.4 was built from the buggy source, so the drain affected everyone running it.
Verifying
shasum -a 256 TimeSync-0.1.5.zip
# expect: 3f174475e7138cba0428d8c463a26a98694d0e9d0467dd8fb2a9571e8becb59b
unzip TimeSync-0.1.5.zip
spctl -a -vvv TimeSync.app
# expect: source=Notarized Developer ID, accepted
Upgrading
Quit TimeSync, drop the new TimeSync.app over the old one in /Applications/, launch. Helper protocol unchanged in this release; no helper reinstall needed.
To confirm the fix is taking effect on your Mac, with the popover closed:
ps -o %cpu= -p $(pgrep -f TimeSync.app | head -1)
Should read under 2% pretty much always.
License: MIT — see LICENSE.
73 de Manoj VU2CPL