bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk startup time


From: Andrew J. Schorr
Subject: Re: [bug-gawk] gawk startup time
Date: Fri, 14 Dec 2018 12:50:30 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Dec 14, 2018 at 11:33:17AM -0600, Peng Yu wrote:
> http://www.drdobbs.com/shell-corner-bash-dynamically-loadable-b/199102950
> 
> Bash also has a loadable extension that can be used to load a dynamic
> library. I think that it should be able to make gawk as a bash
> loadable to reduce the startup time of gawk. See below---gawk startup
> time is much slower than a bash function or a bash built-in command.
> 
> Will it cause any problem to make gawk a bash loadable module (e.g.,
> could it conflict with the extension loading facility in gawk)?

I think you are underestimating the challenges, but feel free to give it a try.

Why are you so concerned with overhead?  You are comparing apples and oranges.
Running an external program is very different than running an internal bash
command.

More relevant comparisons:

bash-4.2$ time for ((i=0;i<100;++i)); do     /bin/echo -n; done

real    0m0.082s
user    0m0.037s
sys     0m0.050s

bash-4.2$ time for ((i=0;i<100;++i)); do     gawk 'BEGIN {}'; done

real    0m0.135s
user    0m0.049s
sys     0m0.089s

bash-4.2$ time for ((i=0;i<100;++i)); do     gawk 'BEGIN {printf ""}'; done

real    0m0.146s
user    0m0.051s
sys     0m0.099s

bash-4.2$ time for ((i=0;i<100;++i)); do     python -c pass; done

real    0m1.516s
user    0m1.178s
sys     0m0.305s

bash-4.2$ time for ((i=0;i<100;++i)); do     python -c 'print("", end="")'; 
done 

real    0m1.522s
user    0m1.175s
sys     0m0.315s

Regards,
Andy



reply via email to

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