Commit 09762c6
Fix warmup regression: avoid per-expression AppDomain assembly scan (#740)
Since 71d59dc, CustomTypeProvider.GetCustomTypes() includes
base.GetCustomTypes(), which scans every assembly in the AppDomain for
[DynamicLinqType] types. DefaultDynamicLinqCustomTypeProvider only caches
that scan per provider instance, and RuleExpressionParser.Parse built a
new ParsingConfig + CustomTypeProvider for every expression parsed, so
the scan ran for every expression in every rule (KeywordsHelper
enumerates the full type set on each ExpressionParser construction).
For workflows with thousands of rules this regressed warmup ~6.6x
versus 5.0.3 (113.8s vs 17.3s for 20,000 rules with local params and
174 loaded assemblies). The compiled-delegate cache from #727 does not
help here because each rule expression is unique.
Fix:
- Reuse one ParsingConfig/CustomTypeProvider across parses, rebuilding
only when ReSettings.CustomTypes is swapped (AutoRegisterInputType
replaces the array on workflow registration).
- Memoize the merged custom-type set in CustomTypeProvider; it is fixed
after construction but was rebuilt (including the assembly scan) on
every GetCustomTypes() call.
With this change the same 20,000-rule benchmark warms up in 16.3s,
matching 5.0.3, with identical rule results. Addresses the remaining
root cause behind #707.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 354f765 commit 09762c6
2 files changed
Lines changed: 36 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
50 | 58 | | |
51 | 59 | | |
52 | 60 | | |
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
86 | 110 | | |
87 | 111 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 112 | + | |
92 | 113 | | |
93 | 114 | | |
94 | 115 | | |
| |||
0 commit comments