sonar

Scan files at memory bandwidth speed.
Log | Files | Refs

commit 7bc10afc050d521c9808f06a2969574929ce5d04
parent e47006ad123714c9601ce80cf7dd4ba0189c2e09
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Fri, 18 Sep 2026 12:31:31 -0400

main: time each phase of a simulated frame

The frame was timed as a whole, which said it fit the budget but not what it
was spending on. Split three ways it is plain that only one part is
incremental: projecting costs 4.7 ms and ranking 3.7 ms whatever changed,
because both walk the whole tree, while rolling up varies with the work and
averages 1.2 ms. Across a scan that is 276 ms projecting and 220 ranking
against 84 rolling up.

Diffstat:
Mlive.odin | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/live.odin b/live.odin @@ -68,17 +68,22 @@ run_live :: proc(volume: string, mount: string, opts: ntfs.Read_Options) -> int frame_start := time.tick_now() if ntfs.mft_ready(&m) { - // Both of these have to be cheap, because they run every frame. + t_project := time.tick_now() if err := ntfs.to_tree(&m, &t, &projection); err != nil { fmt.eprintfln("error: %v", err) return 1 } + d_project := time.tick_since(t_project) // Only what became final this frame, plus whatever is still waiting on an // ancestor. Totals carry over rather than being rebuilt. + t_roll := time.tick_now() rollup_advance(&roll, &t, projection.fresh[:]) + d_roll := time.tick_since(t_roll) + t_rank := time.tick_now() top: [TOP_N]Sized count := rank(&t, roll.totals[:], top[:]) + d_rank := time.tick_since(t_rank) if count > 0 { scan.node(&t, t.root).name = mount } @@ -91,15 +96,16 @@ run_live :: proc(volume: string, mount: string, opts: ntfs.Read_Options) -> int previous = top fmt.printfln( - "frame %3d %6.0f ms %8d nodes %6d fresh %6d pending %10s cost %5.1f ms stable %d", + "frame %3d %6.0f ms %8d nodes %6d fresh %6d pending | project %5.2f roll %5.2f rank %5.2f total %5.2f ms", frames, time.duration_milliseconds(time.tick_since(start)), t.nodes_done, len(projection.fresh), len(roll.pending), - human(count > 0 ? top[0].bytes : 0), + time.duration_milliseconds(d_project), + time.duration_milliseconds(d_roll), + time.duration_milliseconds(d_rank), time.duration_milliseconds(time.tick_since(frame_start)), - settled, ) free_all(context.temp_allocator) }