This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
av_exists: dont make a mortal never to use it
authorbulk88 (via RT) <perlbug-followup@perl.org>
Fri, 23 Nov 2012 00:33:34 +0000 (16:33 -0800)
committerSteffen Mueller <smueller@cpan.org>
Fri, 23 Nov 2012 07:44:44 +0000 (08:44 +0100)
commit716ae3b03e04a6b0ae19b882828eecf4ffc4c458
tree68d3ee01bfa40b2c1fab5bc6ee1b15951320e8d8
parent3315335cdf1a9156473dc3b0a3f34ac9ec7faf4a
av_exists: dont make a mortal never to use it

Make av_exists slightly smaller and faster by reducing the liveness of a
mortal SV and using a NN SvTRUE_nomg.

There were 3 cases, where this mortal would be created, yet a return
happened and the mortal went unused and was wasted. So move the mortal
creation point closer to where it is first used. Also var sv will never be
null, so use a NN version of SvTRUE_nomg created in commit [perl #115870].
The retbool line isn't actually required for optimization reasons, but was
created just in case something in the future changes or some unknown
compiler does something inefficiently.

For me with 32 bit x86 VC 2003, before av_exists was 0x1C2, after 0x1B8.

Comment from committer: Includes SvTRUE_nomg_NN from [perl #115870].
av.c
sv.h