develooper Front page | perl.perl5.porters | Postings from October 2014

[perl #121845] EXTEND_MORTAL usage is questionable

Thread Previous
Tony Cook via RT
October 8, 2014 03:49
[perl #121845] EXTEND_MORTAL usage is questionable
Message ID:
On Sat May 10 21:57:01 2014, bulk88 wrote:
> While looking through the core, I found usage of the EXTEND_MORTAL
> macro. It seems to be used as an optimization for later sv_newmortal
> or
> sv_2mortal calls. The problem is, EXTEND_MORTAL is executed AGAIN in
> every sv_newmortal and sv_2mortal through PUSH_EXTEND_MORTAL__SV_C.

Most of the EXTEND_MORTAL() calls I see make sense in the case where the code might return a large number of mortals, like in pp_aassign and pp_mapwhile, since it will avoid expensive reallocations of PL_tmps_stack.

It's obviously much less useful in some other places:

- pp_stat - it always returns 0 or 13 items, and 13 is well below the minimum growth size (128)

- pp_gmtime - always extends by 1 or 9.

Do any of the other uses strike you as wasteful or incorrect?


via perlbug:  queue: perl5 status: new

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About