bug-bash
[Top][All Lists]
Advanced

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

Re: Possible eval builtin speedup?


From: Jan Schampera
Subject: Re: Possible eval builtin speedup?
Date: Fri, 07 Mar 2008 06:05:05 +0100
User-agent: IceDove 1.5.0.14pre (X11/20080208)

Nicolas Bonifas wrote:
>>  > I don't know much about bash internals, but there is probably room for
>>  > a huge performance improvement in speeding up the eval builtin.
>>  > What do you think about it? Would it be a difficult task?
>>
>>     It is more likely to be the command substitution that is slow.
> 
> You're right:
> $ time (echo `dircolors` > /dev/null)
> 
> real    0m0.318s
> user    0m0.312s
> sys     0m0.008s
> 
> I ran the previous tests with bash-3.1. With bash-3.2, echo
> `dircolors` take 0.088s of user time (1/4th of the time needed by
> bash-3.1), and dircolors > dircolors_output && sh ./dircolors_output
> still takes 0.004s, so it is more than 20 times faster than using
> command substitution.
> 
> So, do you think that speeding up command substitution would be a
> difficult task?

I assume you know that the speed issues most likely come from the
operating system's supporting functions like the fork() and exec*()
family members? Executing another process takes time and there is not
much you can do about it.

If you have speed problems while using a huge amount of command
substitutions you either have a bad script design or use the wrong
language for your specific task IMHO.

J.






reply via email to

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