develooper Front page | perl.perl5.porters | Postings from December 2021

Re: "no snails"; or having signatured subs complain about @_

Thread Previous | Thread Next
From:
hv
Date:
December 9, 2021 18:50
Subject:
Re: "no snails"; or having signatured subs complain about @_
Message ID:
202112091752.1B9Hq6P11255@crypt.org
Nicholas Clark <nick@ccl4.org> wrote:
:A single block is likely actually smaller (due to per-block malloc overhead)
:and its cache locality might be slightly better. Steady state (which is
:really what we need to worry about) there won't be any moving of the stack,
:because it will grow to the maximum transient size needed.
:
:(OK, except for crazy deep recursive code that doesn't have a consistent
:idea of how far down the rabbit hole it needs to go)

Hey, that's me. :)

Maybe not steady state, but I don't think even this is a problem as long as
we increase the stack exponentially, and not just "what we need plus maybe
a constant extra". If we grow the stack by a constant factor c > 1 each time,
total bytes moved over the lifetime of the program will be (I think) around
maxsize / (c - 1).

It's only the granularity that could still cause an issue, but I think
crazy deep recursive code would not usually care if one particular
subroutine entry costs a bunch more microseconds than another as long as
amortized cost is low: that's more the preserve of responsive GUI code,
interrupt handlers and benchmarks.

Hugo

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About