Skip to content

Tick the web GUI clock at 1s instead of 100ms - #28

Merged
marcus-crane merged 1 commit into
masterfrom
perf/timeservice-1s-tick
Aug 7, 2026
Merged

Tick the web GUI clock at 1s instead of 100ms#28
marcus-crane merged 1 commit into
masterfrom
perf/timeservice-1s-tick

Conversation

@marcus-crane

Copy link
Copy Markdown
Member

Why

TimeService is the GUI's single global clock: an Observable.interval(100) started at page load and never unsubscribed. zone.js turns every tick into app-wide change detection, so the page re-evaluates all bindings 10×/second forever — including the pure: false ElapsedTimePipe at every use site. On s-221 this is most of the content process's ~17%-of-a-core main-thread cost (the animations fixed in #27 were the rest).

What

One line: UPDATE_INTERVAL_MS 100 → 1000, plus the dist rebuild (bundle 5800c558).

Every consumer displays whole seconds only — ElapsedTimePipe rounds to seconds, the station list's retryCountdown does Math.round(remainingMs / 1000), and TimeAgoPipe doesn't use TimeService — so nothing on screen can look different. Worst case is a counter reading up to a second stale immediately after a phase starts; if that ever bothers anyone, 500ms still captures 80% of the saving.

Notes

🤖 Generated with Claude Code

TimeService drives every live counter in the UI from one
Observable.interval that starts at page load and never stops. Under
zone.js each tick runs change detection across the whole component
tree, so at 100ms the app re-evaluates every binding (including the
impure ElapsedTimePipe, everywhere it appears) ten times a second,
around the clock.

Nothing can display what the extra ticks compute: ElapsedTimePipe and
the station list's retry countdown both round to whole seconds, and
TimeAgoPipe doesn't use TimeService at all. Ticking at 1s keeps every
counter visually identical while cutting the change-detection churn by
90% — worth roughly 10-15 points of a core on the 2-core station PCs,
on top of the animation fix in #27.

dist/ rebuilt (bundle 5800c558), same node 16 workflow as #27.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Marcus Crane <marcus@utf9k.net>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 31164577950

Coverage remained the same at 60.612%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 7741
Covered Lines: 4692
Line Coverage: 60.61%
Coverage Strength: 3.03 hits per line

💛 - Coveralls

@marcus-crane
marcus-crane merged commit af59ba5 into master Aug 7, 2026
14 checks passed
@marcus-crane
marcus-crane deleted the perf/timeservice-1s-tick branch August 7, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants