iosif Viktoratos
iosif Viktoratos

Reputation: 11

Jess rule engine clear function performance

I am using Jess clear() function and it has a slow performance problem (100ms for every call and because i have to use it 20 times it is 2 seconds estimated time). Is there something alternative (a function to shut down the jess engine, or a function to delete all templates, facts and rules) which i can use for higher performance?

Upvotes: 1

Views: 203

Answers (1)

laune
laune

Reputation: 31290

This depends a little on how you run your application. If you call Jess from a Java application, you can simply

for( int i = 0; i < 20; i++ ){ // 20 times
    jess.Rete rete = new jess.Rete();
    // load functions, templates, rules, facts,...
    rete.run();
}

Rather than

jess.Rete rete = new jess.Rete();
// load functions
for( int i = 0; i < 20; i++ ){ // 20 times    
    // load templates, rules, facts,...
    rete.run();
    rete.clear();
}

But note that, depending on the number of your facts and Pojos, either procedure may delete lots of Java objects, with the usual consequence. But you won't be able to avoid that, and it isn't a Jess problem either.

Upvotes: 1

Related Questions