Skip to content

Commit

Permalink
perf: Optimize the processing speed of EvaluateRuleAction (#612)
Browse files Browse the repository at this point in the history
Co-authored-by: shaoxiaoxu <[email protected]>
Co-authored-by: YogeshPraj <[email protected]>
  • Loading branch information
3 people authored Aug 23, 2024
1 parent ce6c558 commit a9c3c6e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/RulesEngine/Actions/ActionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public bool TryGetContext<T>(string name,out T output)
{
try
{
//key not found return
//Returning a KeyNotFoundException has a significant impact on performance.
if (!_context.ContainsKey(name))
{
output = default(T);
return false;
}
output = GetContext<T>(name);
return true;
}
Expand Down

0 comments on commit a9c3c6e

Please sign in to comment.