Skip to main content

Module script_stats

Module script_stats 

Source
Expand description

What the JavaScript side costs, per frame.

The renderer has published real timings for a while: resolve, paint and present. Script execution had none, so a profile could show a 4ms frame and a UI that still felt slow, with nothing in between to look at. Every reactive update, event handler, timer callback and microtask drain runs through ScriptDocument::poll, so timing that one boundary accounts for the whole language runtime without threading a clock through Boa.

Deliberately mirrors blitz_shell::frame_stats: a bounded ring, means and tails rather than a running average, and no data reported as zero when there is no data at all.

Structs§

BoundaryCounters
What crossed from JavaScript into the host, in bytes.
ScriptStatsSnapshot
Mean, 95th percentile and worst case for the retained polls, in milliseconds.
Timed
The zero-cost stand-in. Same call sites, no clock, no bucket, no drop glue.

Functions§

boundary_counters
What has crossed on this thread since the last reset_boundary_counters.
clear
Discard every retained script and DOM timing sample.
latest_script_stats
None until script has actually run, so a caller reports “no data” rather than printing zeros that look like a measurement.
record_poll
Record one poll. Cheap enough to leave on: a lock and a push.
record_static
Attribute a slice of script time to a fixed source, without allocating.
record_work
Attribute a slice of script time to a named source.
reset_boundary_counters
Zero the boundary counters for this thread.
work_breakdown
The costliest sources seen so far, worst total first.