You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a list of ideas for optimizations that could be implemented via AST modification. Some of these ideas are probably bad. This is a living list, in no way finalized, and will likely change in the future.
in __init__, remove any assignments of self.var = [zero value]
when a storage variable is referenced more than once without being written to, create a memory variable
remove memory variables that are initialized but never used
for an if statement where both the if and else blocks end in a return, move the else block logic into the body of the parent block (note: potential scoping concerns)
convert > 0 to != 0 for unsigned integer comparisons
if a memory variable is initialized and only referenced once, replace the reference with the right-hand side of the initialization
if the final node in a function body is a for loop, and the function returns None, replace any return statements inside the function with break
if constant folding results in if True: or if False: remove the block or the else block (consider scoping here)
within the context of a for loop, if there are multiple lookups of some_long_array[i] without any assignments, copy the value to a new memory value to save on lookups
The text was updated successfully, but these errors were encountered:
This is a list of ideas for optimizations that could be implemented via AST modification. Some of these ideas are probably bad. This is a living list, in no way finalized, and will likely change in the future.
__init__
, remove any assignments ofself.var = [zero value]
if
statement where both theif
andelse
blocks end in a return, move the else block logic into the body of the parent block (note: potential scoping concerns)> 0
to!= 0
for unsigned integer comparisonsNone
, replace anyreturn
statements inside the function withbreak
if True:
orif False:
remove the block or the else block (consider scoping here)some_long_array[i]
without any assignments, copy the value to a new memory value to save on lookupsThe text was updated successfully, but these errors were encountered: