-
Notifications
You must be signed in to change notification settings - Fork 104
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
CSE Machine: Avoid pushing unnecessary env instructions #1687
Conversation
Pull Request Test Coverage Report for Build 8786106267Details
💛 - Coveralls |
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.
This is a safe strategy to avoid unnecessary env instructions. It could be further generalized, but this is good enough for now. The advantage is that it is easy to do: doesn't complicate the machine very much.
@martin-henz yes, I was thinking that further generalization would add extra complication to what is a pedagogical strategy. If this is desired then I can further work on it in the future to be more exhaustive. |
The the code is not very efficient at all, it seems; we can just early return instead of iterating through the entire control every single step of the cse machine I'm pretty sure this alone accounts for most of the 40minutes same thing for the switch case logic, lots of unnecessary computation @sayomaki : @RichDom2185 : because the same computation is being repeated at every step it should have been memoised just create a new field in the control item and calculate it once only instead of calculating n times for each item where n is the number of control items |
Description
This PR implements simple logic to avoid pushing
envInstr
when not needed. Specifically,envInstr
can be avoided if there are no environment-dependent commands on the control. A command is environment-dependent if its evaluation depends on the context given by the current environment.Implements and resolves #1682
Type of change
How to test
The following programs should run with no environment instructions being pushed