I'm constructing an expert system by embedding CLIPS 6.31 into a C++ application dealing with a medium-sized flow of data and requiring an almost real-time response (i. e. total analysis time shouldn't surpass 40 milliseconds). By now I fed some 430 facts to the "entry point" of the inference engine (the knowledge base is comprised by 8 rules, most of which are fired on every iteration, which is achieved through EnvRefresh(...)
) in a loop which resulted in the response time oscillating between 600 and 700 ms, which is much bigger than necessary. Is there any way of speeding up the inference? How "heavy" can the rule patterns if real-time response is of importance? Is CLIPS at all suitable for a real time application like that or should it be replaced with CLIPS/R2 or something similar?
It's hard to analyze performance issues with just a general description of the code. Here are two questions on Stack Overflow illustrating rules that can be rewritten to improve performance:
How to optimize pattern matching between different templated facts in CLIPS
You can also compile your C++ program with profiling enabled to see where time is being spent. Using the refresh command as part of your normal execution raises a few red flags.
Last I heard, CLIPS/R2 is no longer available, in part due to the performance improvements in CLIPS 6.3.