LV-MQTT-Broker icon indicating copy to clipboard operation
LV-MQTT-Broker copied to clipboard

Optimization: Cache nonmatching filter results

Open plundeen opened this issue 3 years ago • 4 comments

If I am reading it correctly, it looks like you could further optimize the Topic pattern match evaluation in MQTT Server.lvlib:_Subscription.lvclass:Evaluate Match.vi. As it stands, if a given topic name matches the subscription pattern, it is cached so the pattern matching/wildcard evaluation does not be be performed on each subsequent sample. But if the name does not match, the result is not cached, so subsequent samples of that topic have to be reevaluated every time.

Perhaps there are some nuances that I am overlooking that preclude subsequent samples of a non-matching topic. Feel free to close if I have misinterpreted. But I think it would save some processing overhead if the evaluation was done for each unique topic name exactly once, regardless of whether it matched or not. So, the cache variant attribute table would end up having an entry for every topic, with the corresponding value the result of the evaluation.

plundeen avatar Mar 25 '21 15:03 plundeen