test(mem-probe): confirm A0 drops production per-script RSS ~11x (18->~1.66 MiB)
Swap MemProbe's ProjectReference from Core.VirtualTags to Core.Scripting.Abstractions so the heavy-mode globalsType (ScriptGlobals<VirtualTagContext>) 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.
This commit is contained in:
@@ -17,7 +17,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LeanContext\LeanContext.csproj" />
|
||||
<ProjectReference Include="..\..\..\src\Core\ZB.MOM.WW.OtOpcUa.Core.VirtualTags\ZB.MOM.WW.OtOpcUa.Core.VirtualTags.csproj" />
|
||||
<!-- After A0: VirtualTagContext + ScriptGlobals live in Core.Scripting.Abstractions
|
||||
(Roslyn-free). We reference that directly so typeof(VirtualTagContext).Assembly
|
||||
resolves to the lean assembly — the key invariant the probe is verifying. -->
|
||||
<ProjectReference Include="..\..\..\src\Core\ZB.MOM.WW.OtOpcUa.Core.Scripting.Abstractions\ZB.MOM.WW.OtOpcUa.Core.Scripting.Abstractions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -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<VirtualTagContext>
|
||||
// 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<TContext> (which exposes the named `ctx` property), NOT the raw context.
|
||||
// heavy = ScriptGlobals<VirtualTagContext> -> wrapper lives in Core.Scripting AND the
|
||||
// generic arg VirtualTagContext lives in Core.VirtualTags; both -> Roslyn.
|
||||
// heavy = ScriptGlobals<VirtualTagContext> -> 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"
|
||||
|
||||
Reference in New Issue
Block a user