public BenchmarkRuleAction() { var ruleExpressionCompiler = new RuleExpressionCompiler(); Expression <Action <IContext, string, int, decimal> > expression = (c, s, i, d) => PerformAction(c, s, i, d); var element = Element.Action(expression); var map = IndexMap.CreateMap(element.Imports, element.Imports); _ruleAction = ruleExpressionCompiler.CompileAction(element, element.Imports.ToList(), new List <DependencyElement>(), map); var compiledRule = new CompiledRule(null, element.Imports, new [] { _ruleAction }, null, map); var tuple = ToTuple("abcd", 4, 1.0m); var activation = new Activation(compiledRule, tuple); _actionContext = new ActionContext(Context.Session, activation, CancellationToken.None); }
public BenchmarkLhsExpression() { _nodeInfo = new NodeInfo(); var ruleExpressionCompiler = new RuleExpressionCompiler(); Expression <Func <string, int, decimal, bool> > betaExpression = (s, i, d) => s.Length == i; var betaElement = Element.Condition(betaExpression); _lhsExpression = ruleExpressionCompiler.CompileLhsTupleFactExpression <bool>(betaElement, betaElement.Imports.ToList()); _lhsTupleExpression = ruleExpressionCompiler.CompileLhsTupleExpression <bool>(betaElement, betaElement.Imports.ToList()); _tuple = ToTuple("abcd", 4, 1.0m); Expression <Func <string, bool> > alphaExpression = s => s.Length == 1; var alphaElement = Element.Condition(alphaExpression); _lhsFactExpression = ruleExpressionCompiler.CompileLhsFactExpression <bool>(alphaElement); _fact = new Fact("abcd"); }