home Forums # Technical Support Execution speed Reply To: Execution speed



thanks for your feedback. The only way to further improve performance in activationDegree is as follows.

(1) Change if (fuzzyOperator->name == Rule::andKeyword()) { for if (fuzzyOperator->name == "and") {. After the performance studies I have performed, I was surprised to see a performance impact when using methods instead of class properties. For example, see this commit, where I changed the method getHeight() for a call to Term::_height and improved performance. However, I will not change the Rule::andKeyword() method over performance given the flexibility it provides to rename the and keyword.

(2) if you are not using Hedges, you could enclose the for-loop statement `for (std::vector::const_reverse_iterator rit = proposition->hedges.rbegin();
11.3%: rit != proposition->hedges.rend(); ++rit) {into anif` statement. This could improve performance a bit more. See latest commit 1759d9159d9a046f3eff9855399f5da2ca5d0ff2

(3) if you check the commit I mentioned earlier (namely 053052a850a81971e207d84ef88573a1c9543aea) you could improve performance by declaring FL_IS_NAN(x) instead of calling the method Op::isNaN(x). This will slightly improve performance, too.

Lastly, I am not sure how you are measuring the performance of your controller, but you could also check the code in Console::benchmarkExamples. Basically, measure the average of ten runs exporting your controller with FldExporter for a resolution specified based on the number of input variables and amount of time you are willing to wait. Compiling with FL_CPP11=ON in v5.1 (from branch release), from console I just run fuzzylite benchmarks path/to/examples 10 and it will measure the performance over ten runs of almost every example included in the examples/original folder.

Thanks again for your feedback, and let me know if you find other ways to further improve performance.