Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
We can execute one less opcode in every iteration (except for the first) of every for-loop by changing from
GET_ITERtop: FOR_ITER [body] JUMP_BACKWARDS(top)cleanup:end:to
GET_ITER JUMP_FORWARD(bottom)body: [body]bottom: FOR_END(body)cleanup:end:This was suggested by@markshannonhere, but it appears to be similar in spirit toLoop Inversion.
There seems to be a small (on the order of 1%) benefit, but I imagine the benefit will be magnified after any specialization.