foxfriends / lumber

Embeddable logic scripting language
5 stars 1 forks source link

Performance improvements #29

Closed foxfriends closed 3 years ago

foxfriends commented 3 years ago

Lumber is... very slow. Especially when dealing with very large structures. See root: it takes over a second to answer simple queries, as the game structure is very large. I have not yet looked in to which part is slow, but I would assume it is unification. Why is it so slow? Can it be sped up?

foxfriends commented 3 years ago

I suspect it's because of all the cloning that happens as part of unify_patterns. Using Cow (so we can share whenever possible) or Rc (so unmodified clones become cheap) would probably be a relatively easy way to speed this up.