This repository was archived by the owner on Jun 1, 2023. It is now read-only.
Commit 97bc409
pp_iter(): jump directly to op after OP_AND
AN OP_ITER's op_next field always points to an OP_AND node. Rather than
pushing &PL_sv_yes or &PL_sv_no and then passing control to the OP_AND,
make pp_iter() return the OP_AND's op_next or op_other directly, depending
on whether this is the last iteration or not.
For an empty body, this cuts about 20% off the time of an iteration.
It's possible that some weird optree-munging XS module may break this
assumption. For now I've just added asserts that the next op is OP_AND
with an op_ppaddr of Perl_pp_and; if that assertion fails, it may be
necessary to convert pp_iter()s' asserts into conditional statements.
In the longer term it might be worthwhile converting OP_ITER from a
BASEOP into a LOGOP and eliminate the OP_AND from the optree altogether.
Alternatively, perhaps pp_iter could just tail call Perl_op_leavesub
directly after the last iteration?1 parent 1b6e616 commit 97bc409
2 files changed
+26
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
166 | 174 | | |
167 | 175 | | |
168 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3177 | 3177 | | |
3178 | 3178 | | |
3179 | 3179 | | |
3180 | | - | |
3181 | 3180 | | |
3182 | 3181 | | |
3183 | 3182 | | |
| |||
3349 | 3348 | | |
3350 | 3349 | | |
3351 | 3350 | | |
3352 | | - | |
3353 | | - | |
3354 | | - | |
3355 | | - | |
3356 | | - | |
| 3351 | + | |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
3357 | 3362 | | |
3358 | 3363 | | |
3359 | | - | |
3360 | | - | |
3361 | | - | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
3362 | 3370 | | |
3363 | 3371 | | |
| 3372 | + | |
3364 | 3373 | | |
3365 | 3374 | | |
3366 | 3375 | | |
| |||
0 commit comments