bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] make function local


From: Greg Wooledge
Subject: Re: [Help-bash] make function local
Date: Mon, 20 Apr 2015 16:14:39 -0400
User-agent: Mutt/1.4.2.3i

On Mon, Apr 20, 2015 at 03:04:00PM -0500, Peng Yu wrote:
> Hi Chet,
> > I disagree that performance overhead in typical use is `significant'.
> > This point is more or less identical to the one I discussed Friday in
> > regards to creating huge numbers of variables.  Who creates 100,000
> > shell functions in a single script?  The overhead, such as it is, of
> > creating and calling even 10,000 functions is negligible.
> 
> Why do you assume that one only calls each of these functions once?
> What if a function is called thousands of time?

The point is, the performance is *perfectly acceptable* if your script
only defines 10,000 functions instead of 100,000 functions.  You are
arguing to make a performance tuning adjustment for a situation that
will never arise in real life.

> The performance difference is 10x different (0.490s vs 0.040s). To me,
> this is a huge performance problem.

It would be a "huge performance problem" (maybe) if your script actually
declared 100,000 functions.

Do you have any scripts that declare 100,000 functions?

> The main point that Linda and I are making is that we suggest add the
> local function feature. I believe that we've made the case --- it
> makes the code cleaner and run faster.

What makes you think adding function namespaces (or whatever means of
localization) would make things run FASTER instead of slower?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]