Branch: refs/heads/davem/padsv_store Home: https://github.com/Perl/perl5 Commit: 6c77c095ba2add4b74b70cdbc54c76338152cda8 https://github.com/Perl/perl5/commit/6c77c095ba2add4b74b70cdbc54c76338152cda8 Author: David Mitchell <da...@iabyn.com> Date: 2024-06-19 (Wed, 19 Jun 2024)
Changed paths: M ext/B/t/optree_varinit.t M peep.c M pp_hot.c M t/perf/opcount.t Log Message: ----------- OP_PADSV_STORE: only in void context (The original commit, v5.39.6-108-gc90e7ed39e, was reverted by v5.39.8-35-gdc524b6cbd, and is now being re-applied. Originally it broke some CPAN distributions and as it was near code-freeze time and was only an optimisation, it seemed better to leave it for later. Since we're now early in the cycle of 5.41.x, there's more time to fix up any fallout.) ---- For the optimisation which converts $lex = expr into an OP_PADSV_STORE op, only optimise if the scalar assign is in VOID context. This allows us to stop pp_padsv_store() from uselessly pushing the result onto the stack, only to be immediately popped again by the following nextstate or unstack op. This becomes more important on PERL_RC_STACK builds, as each push or pop involves manipulating the SV's reference count. I'm working on the assumption that scalar/list/unknown cxt lexical assigns are rare enough that not optimising them is less of a loss than optimising the void case. So: $lex = ....; # void: now even faster $other = $lex = ...; # scalar: now slow again foo($lex = ..., ....); # list: now slow again sub { .... $lex = ...; # unknown: now slow again } To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications