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:
| Level | What it covers here |
|---|---|
file | discovery, and reading and parsing every source file (through the shared parse cache) |
unit | grouping, the per-unit symbol tables and signatures, uses/consumes resolution, and each unit’s symbol composition and prelude |
definition | resolving and checking every declaration body, plus test bodies and the platform lock |
project | the 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
leveluntil the nextmark. A no-op unlessBYNK_PHASE_TIMINGis 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 andbeginran.