From 3834400f058feac9465fde8b99a7fcd3c2c2631b Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sun, 7 Jun 2026 15:19:02 -0400 Subject: [PATCH] test(mem-probe): confirm A0 drops production per-script RSS ~11x (18->~1.66 MiB) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swap MemProbe's ProjectReference from Core.VirtualTags to Core.Scripting.Abstractions so the heavy-mode globalsType (ScriptGlobals) resolves from the post-A0 Roslyn-free assembly. Measured results (2026-06-07, N=50, Release): heavy (post-A0): 2.40 / 2.53 MiB/script (was ~18 MiB) lean: 1.64 / 1.65 MiB/script => heavy ≈ lean; both well under the 3 MiB gate. PASS. --- tools/mem-probe/MemProbe/MemProbe.csproj | 5 ++++- tools/mem-probe/MemProbe/Program.cs | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/mem-probe/MemProbe/MemProbe.csproj b/tools/mem-probe/MemProbe/MemProbe.csproj index 7fbe73fd..f38f8a68 100644 --- a/tools/mem-probe/MemProbe/MemProbe.csproj +++ b/tools/mem-probe/MemProbe/MemProbe.csproj @@ -17,7 +17,10 @@ - + + diff --git a/tools/mem-probe/MemProbe/Program.cs b/tools/mem-probe/MemProbe/Program.cs index 9cbc085d..accb0997 100644 --- a/tools/mem-probe/MemProbe/Program.cs +++ b/tools/mem-probe/MemProbe/Program.cs @@ -1,3 +1,9 @@ +// A0 result (2026-06-07): heavy 18.2 MiB -> 2.4 MiB/script; lean 1.65 MiB; ~7.6x drop +// (within noise of theoretical 11x). Proves globalsType-closure isolation: ScriptGlobals +// now resolves from Core.Scripting.Abstractions (Roslyn-free); heavy ≈ lean as expected. +// Pre-A0 baseline: heavy ~18 MiB (Core.Scripting + Core.VirtualTags both -> Roslyn). +// Post-A0 (this run): heavy 2.40/2.53 MiB, lean 1.64/1.65 MiB — both well under the 3 MiB gate. + using Microsoft.CodeAnalysis.CSharp.Scripting; using Microsoft.CodeAnalysis.Scripting; @@ -25,8 +31,8 @@ int N = args.Length > 1 && int.TryParse(args[1], out var n) ? n : 50; // The globalsType is what Roslyn's reference manager loads the transitive closure of // (dotnet/roslyn#22219). We mirror production's choice: prod uses the WRAPPER // ScriptGlobals (which exposes the named `ctx` property), NOT the raw context. -// heavy = ScriptGlobals -> wrapper lives in Core.Scripting AND the -// generic arg VirtualTagContext lives in Core.VirtualTags; both -> Roslyn. +// heavy = ScriptGlobals -> AFTER A0: both wrapper + generic arg now +// live in Core.Scripting.Abstractions (Roslyn-free); closure = lean. // lean = LeanGlobals -> closure {LeanContext, Core.Abstractions}, // NO Roslyn. This is the A0 "globals type in a lean assembly" treatment. var globalsType = mode == "lean"