Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a safe way to clone the engine? (deep copy) #53

Open
lauraeci opened this issue May 10, 2016 · 1 comment
Open

Is there a safe way to clone the engine? (deep copy) #53

lauraeci opened this issue May 10, 2016 · 1 comment

Comments

@lauraeci
Copy link

I'm looking at this gem duplicate

Duplicate.duplicate(@engine)

What I want to do is create a template wongi engine and reuse it over and over again. Originally I was loading all the rules in to one engine all at once but then the engine seems to be getting too big. So another approach I tried was to load the common rules into the engine once, then copy the engine and use the copy so that the engine is only looking for the most recent "target" facts for matching with all the common facts. Hopefully this makes it a smaller set as I noticed that the matching starts out very fast and then slows down considerably.

Let me know if that's something that makes sense to do. I'm not sure that the deep copy is working correctly because now I see duplicate matches. Since it seems like the engine is very complicated/recursive, not sure the deep copy is a good idea.

I would love to hear your thoughts on this.

Thanks!
-Laura

@ulfurinn
Copy link
Owner

Since it seems like the engine is very complicated/recursive, not sure the deep copy is a good idea.

Exactly that. There are tons of cross-references between internal objects.

Have you tried using overlays?

Admittedly I've never looked into performance optimization. Maybe it's time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants