Skip to content

docs: record that the timeline event budget is hardware dependent - #1756

Closed
Joesirven wants to merge 1 commit into
get-bb:mainfrom
Joesirven:fix/timeline-budget-hardware-variance
Closed

Joesirven wants to merge 1 commit into
get-bb:mainfrom
Joesirven:fix/timeline-budget-hardware-variance

Conversation

@Joesirven

Copy link
Copy Markdown

Refs #1749.

timelineWindowEventBudget is set to 1500 on the basis of a measured ~0.06ms/event, aiming to keep a cold build near 100ms.

Measured on a 4-core / 4.9 GiB VPS across 541 samples taken from bb's own Thread timeline build blocked the event loop logging:

metric value
p50 0.479 ms/event
p90 0.964 ms/event
max 5.55 ms/event

So a full 1500-event window costs roughly 720ms of blocked event loop there, not 100ms. Session totals on that host: 1656 slow builds, 155 seconds of blocked loop, with event-loop stall samples showing p95 maxDelay of 5058ms.

This change is deliberately documentation only. It records the spread next to the constant and explains in docs/configuration.md how to derive your own per-event cost from the existing logging and lower the budget accordingly.

I did not change the default, since that is a judgement call for maintainers rather than something to infer from one host.

The underlying issue is that a fixed event count is a weak proxy for cost when per-event cost varies ~8x across hardware. Happy to follow up with either startup calibration from a measured sample, or budgeting on decoded bytes instead of event count (event-json-decode is the dominant stage — 181ms of a 332ms build in one sample). Let me know which you would prefer and I will open it.

The 1500-event default is justified by a measured ~0.06ms/event, but that
figure varies widely with hardware. On a 4-core / 4.9 GiB VPS it measures
0.479ms/event at p50 across 541 samples, so a full window costs ~720ms of
blocked event loop rather than the ~100ms the constant targets.

Record the spread next to the constant and tell operators in
docs/configuration.md how to derive their own per-event cost from the
existing stall logging and lower the budget accordingly.

Refs get-bb#1749

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

I am SlopCop. I am reviewing this pull request now.

I will check security, code quality, performance, architecture, duplication, and the relevant product behavior.

Comment thread docs/configuration.md
can be closer to 0.5ms, making a full window ~720ms of blocked event loop
instead of ~100ms. If `Thread timeline build blocked the event loop` appears
often, divide a logged build's `totalDurationMs` by its `eventRowCount` to get
your real per-event cost and lower this budget until a full window fits your

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — This formula gives a false level of accuracy.

The logger records only builds that take at least 150 ms. It also limits reports to one per thread every 30 seconds.

A logged profile can have eventRowCount: 0, so this division can fail. totalDurationMs also includes work outside the selected event rows.

Call this ratio a coarse estimate and require a positive event count. Also state that one completed turn can exceed the budget.

*
* That per-event cost is hardware dependent and the spread is wide: on a
* 4-core / 4.9 GiB VPS it measures 0.479ms/event at p50 (p90 0.964,
* max 5.55) across 541 samples, roughly 8x the figure above, which puts a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — This source comment stores a selected measurement as a general property.

The 541 samples include only builds above the 150 ms log threshold. The logger also removes repeated reports during each 30-second period.

CPU speed and event data size both change this ratio. Remove the percentiles from this shared default comment.

Keep a stable statement that the event count is a hardware-dependent and data-dependent proxy. Put host-specific data and limits in the guide.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Plain English summary: This PR explains that timeline builds can cost much more on small hosts. It changes no runtime behavior.

It tells operators to lower the event limit after slow-build logs. The main point is correct, but the measurement advice needs two corrections.

  1. Medium — The claimed per-event ratio comes from builds that already exceeded 150 ms. The logger also samples one report per thread each 30 seconds. Thus, the 541 samples do not describe typical builds. CPU speed and event data size also affect each ratio. Remove the percentiles from the shared source comment. Keep a stable statement that the event count is only a proxy.

  2. Medium — The guide calls one division the "real" per-event cost. The numerator includes other work, and the denominator can be zero. One completed turn can also exceed the event budget. Call this ratio a coarse estimate. Require a positive event count. State the completed-turn limit.

Architecture and duplication: The PR repeats the same host data in a source comment and the configuration guide. Keep the code comment short. Put operator advice, sample data, and measurement limits in the guide. The existing byte budget gives a better cost proxy, but this PR does not change it.

Security: I found no security issue. The PR changes only documentation and comments.

Performance: The PR changes no runtime path. The arithmetic 0.479 × 1500 ≈ 720 is correct, but the source sample is selected.

End-to-end test: A dev-server browser test does not apply. The PR changes no application route, and I did not run code from the fork.

Validation: I inspected the exact patch, the logger, the timeline builder, related tests, history, and the linked issue report. git diff --check passed. CI build, typecheck, lint, package smoke, and all test jobs passed. The required Checks job fails in the plugin SDK version guard. The changed files do not touch that SDK, but this check still blocks the merge.

I posted both review findings as inline comments. I used comment status only.

@SawyerHood SawyerHood closed this Aug 19, 2026
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