-
Notifications
You must be signed in to change notification settings - Fork 13
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
Optimization problem: eliminate temporary variables #52
Comments
This is indeed happening and can be quite burdensome especially when drawing. For example, this code snippet
even with optimization turned on produces the following:
That not only slows the execution down, it also pushes the code closer to 1000 instructions limit. Fortunately, there's a very helpful workaround: assign all literals passed to functions to a variable:
We get this:
(The optimization will even remove unused variables, so there's no particular need to remove variables for literals that aren't used anymore.) |
This code(again):
compiled, the last 3 lines are:
That is redundant: we can eliminate __tmp27 and run
ucontrol approach __tmp21 __tmp26 2 0 0
instead.Summing up: ANY not-changed temporary variables should be eliminated
PS: I know Java, and I can help make a PR(and make commits) if you want(altho I have very little time)
The text was updated successfully, but these errors were encountered: