That makes defensive nodeToMatches copying cheaper, and improves fireRules performance for a range of scenarios.
Beware, it most likely slightly degrades the performance of inserting facts. However, it might be an acceptable trade-off as in absolute numbers the win is significant when fireRules is called inside the game loop, unless you insert millions of facts each iteration.
That makes defensive
nodeToMatches
copying cheaper, and improvesfireRules
performance for a range of scenarios.Beware, it most likely slightly degrades the performance of inserting facts. However, it might be an acceptable trade-off as in absolute numbers the win is significant when
fireRules
is called inside the game loop, unless you insert millions of facts each iteration.