Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all methods using ExpressionCompiler in RuleExpressionCompiler? #327

Closed
snikolayev opened this issue Apr 22, 2023 Discussed in #326 · 1 comment
Closed

Not all methods using ExpressionCompiler in RuleExpressionCompiler? #327

snikolayev opened this issue Apr 22, 2023 Discussed in #326 · 1 comment
Assignees
Labels
Milestone

Comments

@snikolayev
Copy link
Member

Discussed in #326

Originally posted by lustoro April 21, 2023
I've started to use NRules and I'm facing performance issues when Compiling rules by using RuleCompiler.Compile(). I've seen that one of the ways to do some performance improvements is using FastExpressionCompiler suggested here https://github.com/NRules/NRules/wiki/Expression-Compiler. But after doing some performance profiling I've seen that it still works slow for CompileLhsFactExpression in RuleExpressionCompiler.cs. And I've seen that CompileLhsFactExpression do not uses ExpressionCompiler for compilation and only that method do not uses ExpressionCompiler, other methods are using ExpressionCompiler

public ILhsFactExpression<TResult> CompileLhsFactExpression<TResult>(ExpressionElement element)
{
var optimizedExpression = ExpressionOptimizer.Optimize<Func<Fact, TResult>>(
element.Expression, IndexMap.Unit, tupleInput: false, factInput: true);
var @delegate = optimizedExpression.Compile();
var argumentMap = new ArgumentMap(IndexMap.Unit, 1);
var expression = new LhsFactExpression<TResult>(element.Expression, @delegate, argumentMap);
return expression;
}

to have perfromance improvement is it possible to use ExpressionCompiler for CompileLhsFactExpression as well ? And have that change in future version ?

@snikolayev snikolayev added the bug label Apr 22, 2023
@snikolayev snikolayev added this to the 0.9.4 milestone Apr 22, 2023
@snikolayev snikolayev self-assigned this Apr 22, 2023
@snikolayev
Copy link
Member Author

Fixed in commit b8c44a3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant