feat(io): open-time breakdown log
Phase 5.2. Time each open phase — parse, purge, derived-cache build on the loader thread, plus xref resolve on the UI thread — and emit a breakdown line on open completion: parse 1240ms · purge 80ms · caches 340ms · xref 60ms · total 1820ms Makes open-time regressions (and the wins from 1.1 / 2.4) visible at a glance. Timings ride back on DerivedCaches; total is wall time from the Open click to post-xref. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
70702d063f
commit
997538a67a
4 changed files with 42 additions and 2 deletions
|
|
@ -60,11 +60,22 @@ pub async fn open_path_with_phase(
|
|||
let path2 = path.clone();
|
||||
let phase2 = phase.clone();
|
||||
let (doc, caches) = std::thread::spawn(move || -> Result<_, String> {
|
||||
use std::time::Instant;
|
||||
phase2.store(PHASE_PARSING, Ordering::Relaxed);
|
||||
let t_parse = Instant::now();
|
||||
let mut doc = load_file(&path2)?;
|
||||
let parse_ms = t_parse.elapsed().as_millis() as u32;
|
||||
let t_purge = Instant::now();
|
||||
let dropped = purge_corrupt_entities(&mut doc);
|
||||
let purge_ms = t_purge.elapsed().as_millis() as u32;
|
||||
phase2.store(PHASE_CACHING, Ordering::Relaxed);
|
||||
let t_caches = Instant::now();
|
||||
let mut caches = crate::scene::build_derived_caches(&doc);
|
||||
caches.timings = crate::scene::OpenTimings {
|
||||
parse_ms,
|
||||
purge_ms,
|
||||
caches_ms: t_caches.elapsed().as_millis() as u32,
|
||||
};
|
||||
caches.corrupt_dropped = dropped;
|
||||
phase2.store(PHASE_FINALIZING, Ordering::Relaxed);
|
||||
Ok((doc, caches))
|
||||
|
|
|
|||
Loading…
Reference in a new issue