Skip to content

Added option to disable auto type registry#501

Merged
abbasc52 merged 4 commits into
mainfrom
abbasc52/registerTypeConflict
Jul 12, 2023
Merged

Added option to disable auto type registry#501
abbasc52 merged 4 commits into
mainfrom
abbasc52/registerTypeConflict

Conversation

@abbasc52

@abbasc52 abbasc52 commented Jul 12, 2023

Copy link
Copy Markdown

Fixes #500

@abbasc52 abbasc52 merged commit 103e817 into main Jul 12, 2023
@abbasc52 abbasc52 deleted the abbasc52/registerTypeConflict branch July 12, 2023 12:48
YogeshPraj added a commit that referenced this pull request May 27, 2026
#727)

The static MemCache around Compile<T> was removed in v5.0.1 (#501) along
with the AutoRegisterInputType feature. Removing it caused every call to
Compile<T> / CompileRuleExpressionParameters to re-run the dynamic
expression parser and re-emit IL, causing ~10x slowdowns reported in #673
and 100x-1900x slowdowns on the public parser and ExecuteActionWorkflowAsync
paths that are not served by the workflow-level RulesCache.

Reintroduce the cache as an instance field (not static, to avoid the latent
cross-settings sharing bug the old static had). The key includes the
expression text, ordered (paramName, paramType), return type, and a settings
fingerprint covering IsExpressionCaseSensitive, UseFastExpressionCompiler,
and CustomTypes. Scoped-params keys also include each value-expression's
text so workflow mutations correctly invalidate.

Honors the existing ReSettings.CacheConfig; SizeLimit == 0 disables.

Benchmark (median of 5 runs, .NET 8, 30-rule workflow):
  Parser.Evaluate<bool> x 30k:           34,730 ms -> 33 ms   (~1052x)
  Parser.Compile<bool>  x 30k:           34,846 ms -> 18 ms   (~1936x)
  ExecuteActionWorkflowAsync x 1000:      1,182 ms ->  3 ms   ( ~394x)
  ExecuteAllRulesAsync x 1000 (warm):        11 ms -> 17 ms   (within noise)
  Fresh engine x 50:                      1,890 ms -> 1,867 ms (unchanged)

Co-authored-by: Yogesh Prajapati <yogeshcprajapati@outlook.com>
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.

v4 to v5 error: array like an enum

1 participant