Skip to content

perf: share generated VB data context cache helpers - #410

Open
marius-bughiu wants to merge 1 commit into
codex/corewf-02-single-location-scopefrom
codex/corewf-03-share-vb-cache-helpers
Open

marius-bughiu wants to merge 1 commit into
codex/corewf-02-single-location-scopefrom
codex/corewf-03-share-vb-cache-helpers

Conversation

@marius-bughiu

Copy link
Copy Markdown
Contributor

Standalone Visual Basic expression source repeats the same cache-forwarding method in every generated data-context class. Emit it only on the read/write and read-only root classes and route generated calls to the appropriate root. C# and partial-class generation retain their existing output path.

Stack 3/4; base branch codex/corewf-02-single-location-scope. Cumulative results start at public CoreWF commit 65caba7c7fc7d141e847775b00f2c9558e8daa59. None of these optimizations relies on duplicate expression text.

Measured on six synthetic authored cases with scenario-local variables and mostly unique expressions, with execution templates assigned versus removed. All validation and analyzer rules are enabled. Each of the five source-built CoreWF states ran twice per variant in forward/reverse order, serially on the same machine and compiler host. Every run deleted the isolated project .local first. The actual loaded CoreWF image hashes, input inventories, diagnostics and output coverage were verified.

Adjacent change (preceding stack state → this state; medians of two runs):

Metric Templates Before After Delta
Whole process With 25 s 24 s -0.362 s
Whole-process managed allocation With 9.9 GB 9.8 GB -139.90 MB
Compile With 14 s 14 s +0.014 s
Compile managed allocation With 5.7 GB 5.5 GB -178.88 MB
ExpressionsCompiler.CompileExpressions With 7.49 s 8.20 s +0.705 s
Source-generation thread allocation With 678.96 MB 640.62 MB -38.34 MB
Source-parsing thread allocation With 148.05 MB 141.48 MB -6.57 MB
Generated source With 46,395,569 characters 43,327,093 characters -3,068,476 characters
Peak sampled private memory With 2.3 GB 2.5 GB +200.70 MB
Whole process Without 24 s 22 s -1.32 s
Whole-process managed allocation Without 9.6 GB 9.4 GB -182.79 MB
Compile Without 13 s 12 s -0.670 s
Compile managed allocation Without 5.5 GB 5.3 GB -173.54 MB
ExpressionsCompiler.CompileExpressions Without 7.21 s 5.78 s -1.44 s
Source-generation thread allocation Without 676.28 MB 638.09 MB -38.19 MB
Source-parsing thread allocation Without 147.74 MB 139.05 MB -8.69 MB
Generated source Without 46,211,967 characters 43,158,131 characters -3,053,836 characters
Peak sampled private memory Without 2.3 GB 2.4 GB +131.72 MB

Whole-process observations behind the adjacent medians: With templates: before [25 s, 25 s], after [23 s, 26 s]. Without templates: before [24 s, 24 s], after [23 s, 22 s].

Cumulative change (original CoreWF state → this state; same cohort):

Metric Templates Before After Delta
Whole process With 28 s 24 s -3.04 s
Whole-process managed allocation With 10.0 GB 9.8 GB -224.04 MB
ValidateProject With 2.76 s 2.39 s -0.369 s
ValidateProject managed allocation With 1.5 GB 1.5 GB -27.47 MB
AnalyzeProject With 4.18 s 3.37 s -0.813 s
AnalyzeProject managed allocation With 2.1 GB 2.1 GB +1.58 MB
Compile With 15 s 14 s -1.24 s
Compile managed allocation With 5.7 GB 5.5 GB -196.08 MB
Source-generation thread allocation With 689.36 MB 640.62 MB -48.73 MB
Source-parsing thread allocation With 147.00 MB 141.48 MB -5.52 MB
Generated source With 46,395,569 characters 43,327,093 characters -3,068,476 characters
Peak sampled private memory With 2.5 GB 2.5 GB +39.19 MB
Whole process Without 30 s 22 s -7.62 s
Whole-process managed allocation Without 9.6 GB 9.4 GB -185.72 MB
ValidateProject Without 3.39 s 2.42 s -0.968 s
ValidateProject managed allocation Without 1.5 GB 1.5 GB -23.85 MB
AnalyzeProject Without 5.90 s 3.35 s -2.55 s
AnalyzeProject managed allocation Without 2.1 GB 2.1 GB +0.63388 MB
Compile Without 15 s 12 s -2.81 s
Compile managed allocation Without 5.5 GB 5.3 GB -162.24 MB
Source-generation thread allocation Without 686.70 MB 638.09 MB -48.62 MB
Source-parsing thread allocation Without 147.97 MB 139.05 MB -8.92 MB
Generated source Without 46,211,967 characters 43,158,131 characters -3,053,836 characters
Peak sampled private memory Without 2.4 GB 2.4 GB -4.96 MB

Validation: The exact publication commit passed 32 cumulative focused cases and 57 existing cases. The 11 source-generation cases cover generated VB execution, nested/sibling scopes, cache ownership, reference writes, expression trees, and unchanged C#/partial-class paths. Ten behavior cases also passed before this change. Release owner builds used SDK 8.0.426 and net6.0-windows; the compiler host used .NET 10.0.11. The complete CoreWF test suite was not run. Build copies disabled the repository's package-generation/global-cache-cleanup postbuild actions; no such project changes are included in this PR.

These are descriptive six-case diagnostics, not a 1,000-case throughput result or a statistical confidence claim. Host load, GC and run order can affect elapsed time; increases are retained in the tables. Managed allocation is not retained heap size. Nested phases overlap and must not be summed. Deltas use unrounded values; displayed values are rounded independently. Matching compiler output coverage does not establish arbitrary workflow execution or persistence equivalence.

Note

This change and description were prepared with AI assistance; the measurements and test results above were collected locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant