paranim / pararules

A Nim rules engine
The Unlicense
139 stars 3 forks source link

make `MemoryNode.matches` copy-on-write #7

Closed ul closed 1 year ago

ul commented 1 year ago

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.

oakes commented 1 year ago

Thank you!