Trace Event Format summary CLI
0

Configure Feed

Select the types of activity you want to include in your feed.

catapult: memtrace-wire the bench, drop a Format buffer in id namespacing

Wire bench_pb to memtrace (via the memtrace package directly -- observe
depends on nox-catapult, so it cannot) so the encode/decode allocation is
profilable. namespace_frame_id used Fmt.str "%d:%s", a Format buffer per
id; replace with direct concatenation (identical result, no buffer) -- same
class of fix as the Number.to_string one this surfaced. Catapult + json
tests pass.

+7 -2
+2
bench/bench_pb.ml
··· 7 7 trace: encode time, decode time and on-disk size. Run as [bench_pb [frames]] 8 8 (default 2,000,000 frames = 8M events). *) 9 9 10 + let () = Memtrace.trace_if_requested () 11 + 10 12 module Event = Catapult.Event 11 13 module Phase = Catapult.Phase 12 14
+1 -1
bench/dune
··· 1 1 (executable 2 2 (name bench_pb) 3 - (libraries nox-catapult nox-json unix)) 3 + (libraries nox-catapult nox-json unix memtrace))
+4 -1
lib/catapult.ml
··· 76 76 let values = List.filter_map f traces in 77 77 match values with [] -> None | _ -> Some (String.concat "\n" values) 78 78 79 - let namespace_frame_id index id = Fmt.str "%d:%s" index id 79 + (* Direct concatenation rather than [Fmt.str "%d:%s"]: this runs once per event 80 + id during encode/decode, and the Format buffer Fmt.str allocates per call 81 + dominated the trace's allocation. The result string is identical. *) 82 + let namespace_frame_id index id = string_of_int index ^ ":" ^ id 80 83 81 84 let namespace_sf index = function 82 85 | None -> None