This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pad.c: Use PadnamelistMAXNAMED in another place
authorFather Chrysostomos <sprout@cpan.org>
Wed, 27 Aug 2014 06:21:43 +0000 (23:21 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 28 Aug 2014 20:04:17 +0000 (13:04 -0700)
commit7f713aaaca2c8ec3ddd03308f09590cc8e915afe
treebe59b5b8f1ccb351c2127011be1191f1a60effe0
parentb54c5e14b7fb9ecbcf34d74dd140de12cb73ff78
pad.c: Use PadnamelistMAXNAMED in another place

This will speed up pad lookup a little more.  This could be considered
a follow-up to commit 7db6405c.

There is a hack that allows an ‘our’ variable to be found in the pad
in the statement in which it is declared, to avoid a warning (since
the fallback would be to look up the very same variable in the current
package anyway).

This commit applies the PadnamelistMAXNAMED optimisation to that code
path.  This is how that optimisation works:  When named slots are
allocated in the pad, PadnamelistMAXNAMED is set, so that, when
searching for named items in the pad, we don’t have to search the
whole thing if there are many constants or GVs at the end.

Recent commits slowed down t/re/uniprops.t considerably.  This was the remaining bottleneck.

We could actually skip the whole ‘our’ hack for subroutine lookup
(since the warning it avoids doesn’t apply to subroutines anyway).  In
fact, the next commit will do that.  But this optimisation is worth-
while anyway.
pad.c