Skip to main content

Module phase_timing

Module phase_timing 

Source
Expand description

Opt-in per-level timing of one project analysis (#1523, step 2).

#1523’s trigger asks for keystroke-to-diagnostic latency “attributed by level”: R3.13’s four query levels. This attributes the wall time of crate::analysis::analyse_project_with_policy, the pass the language server runs on every edit, to those levels:

LevelWhat it covers here
filediscovery, and reading and parsing every source file (through the shared parse cache)
unitgrouping, the per-unit symbol tables and signatures, uses/consumes resolution, and each unit’s symbol composition and prelude
definitionresolving and checking every declaration body, plus test bodies and the platform lock
projectthe whole-project validations (consumes cycles, name conflicts, exports, providers, event wiring), and assembling the result

The buckets partition the call: every instant belongs to exactly one, so they sum to the round’s time. The boundaries are marked where the pipeline’s own phase comments already put them, so the attribution is as good as that decomposition; it does not claim to be a profile.

Off by default and free when off. Nothing is recorded unless the BYNK_PHASE_TIMING environment variable is set when the process first asks; each mark is then one cached boolean test. When on, finish writes one line to stderr, which cargo xtask bench reads from the language server.

Enums§

Level
One of R3.13’s query levels.

Functions§

begin
Start timing the current analysis, charging time to level until the next mark. A no-op unless BYNK_PHASE_TIMING is set.
finish
Close the current analysis and write one line to stderr: bynk-phase-timing file=<ms> unit=<ms> definition=<ms> project=<ms>.
mark
From here, charge time to level; the time since the last mark goes to the level that was current. A no-op unless timing is on and begin ran.