Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14490

Re: Unexpected delay in using arguments.

From Bize Ma <binaryzebra@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Unexpected delay in using arguments.
Date 2018-08-14 23:00 -0400
Message-ID <mailman.5123.1534302029.1292.bug-bash@gnu.org> (permalink)
References <CAFra36j=UuqHv2Spp26ebAW0dRW+KsgNS21hZJrwuku9QUayWw@mail.gmail.com> <e8f9e834-d58e-6073-45c5-a9cf28212d60@case.edu>

Show all headers | View raw


2018-08-14 11:25 GMT-04:00 Chet Ramey <chet.ramey@case.edu>:

> On 8/12/18 3:16 AM, Bize Ma wrote:
> > Try this script:
> (...)

> Which is a thousand times slower.
>
> If you build a profiling version of bash, you'll find that about 75% of
> that time is spent copying the list of arguments around


I just don't see why there is any need to copy arguments.
Most other shells seem that they don't do that.


> , since you have
> to save and restore it each time you call f1.


There is no need to "copy", that just waste additional memory.
Just point to a new list of arguments (it is a change of only a memory
pointer).
Release the memory when the argument list is not being used any more.



> > Bash 5 is even worse, try:
>
> Bash-5.0-alpha is not a released version, so it uses the debugging malloc.
> If you profile that, you'll find that about 99% of the time is spent
> marking allocations as active and free in the table the bash malloc uses
> to keep track of active memory.
>

Yes, tests with "--without-bash-malloc" and "RELSTATUS=release" were done
after I posted the OP.

Yes, version 5.0 is not corrected, and looks that it is not "worse".
Sorry for the  misrepresentation.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Unexpected delay in using arguments. Bize Ma <binaryzebra@gmail.com> - 2018-08-14 23:00 -0400

csiph-web