Wednesday, 7 August 2013

Microsoft WWF Rules engine: horrible performance

Microsoft WWF Rules engine: horrible performance

I consider using Ms Rule engine out of Workflow context. I like everything
about it other than performance, the loop of 100 items runs as slow as 1
sec on my 3.7Ghz Intel Xeon which is not acceptable:
var rulesReader = new XmlTextReader(@"myrule.rules");
var serializer = new WorkflowMarkupSerializer();
var ruleDefinitions = serializer.Deserialize(rulesReader) as RuleDefinitions;
for (int i = 0; i < 100; i++)
{
RuleSet rs = ruleDefinitions.RuleSets[0];
var validation = new RuleValidation(typeof(Patient), null);
var instance = new Patient();
if (rs.Validate(validation))
{
var execution = new RuleExecution(validation, instance);
rs.Execute(execution);
}
}
This is a single very simple rule inside the file comparing Patient's
attribute to string value. So why is it so slow? Do I do something wrong
or this speed is how it supposed to work?

No comments:

Post a Comment