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
There are some compile-time optimizations RS already does, here are some examples:
for i in range(n):
...
for i in range(n, -1, -1):
...
for i in dir(obj):
...
Which compile into i++, i--, and for ... in loops respectively. These are scattered and hard to follow in the code. Also, due to them occurring at the time of output, the compiler doesn't have the ability to retroactively modify code that has already been output (i.e. removing the range implementation since the only call to it got optimized out). Moving the optimizer out into its own module would allow it to be more durable, consistent and aggressive.
For example, in addition to optimizing [1 to 5] to range(1, 5), we could also optimize it to [1,2,3,4,5] because both start and end are constants.
The text was updated successfully, but these errors were encountered:
There are some compile-time optimizations RS already does, here are some examples:
Which compile into
i++
,i--
, andfor ... in
loops respectively. These are scattered and hard to follow in the code. Also, due to them occurring at the time of output, the compiler doesn't have the ability to retroactively modify code that has already been output (i.e. removing therange
implementation since the only call to it got optimized out). Moving the optimizer out into its own module would allow it to be more durable, consistent and aggressive.For example, in addition to optimizing [1 to 5] to range(1, 5), we could also optimize it to [1,2,3,4,5] because both start and end are constants.
The text was updated successfully, but these errors were encountered: