-
Notifications
You must be signed in to change notification settings - Fork 671
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
Stardew Valley: reuse simplified rules #2393
Stardew Valley: reuse simplified rules #2393
Conversation
this allows skipping multiple simplifications of the same object, e.g. item_rules also update the logic simplification tests to be a proper unittest.TestCase
ac4131a
to
062e051
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably be possible to declare the _simplified field on the parent object, and have some classes like True_() initialize the value to be immediately true. I am not sure this would provide any noticeable improvement in performance, but it could reduce duplication a tiny bit.
Either way, looks good.
True_, False_ and base already have the fastest possible implementation of |
this allows skipping multiple simplifications of the same object, e.g. item_rules also update the logic simplification tests to be a proper unittest.TestCase
this allows skipping multiple simplifications of the same object, e.g. item_rules also update the logic simplification tests to be a proper unittest.TestCase
giving 33% speedup in set_rulesgiving 20% speedup in set_rules
Instead of creating new rules in
simplify()
, we try to replace the current one and remember if it was simplified already. This has the effect of simplification-caching in some of the dicts, like item_rules.