[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] gawk startup time
From: |
arnold |
Subject: |
Re: [bug-gawk] gawk startup time |
Date: |
Sat, 15 Dec 2018 11:01:45 -0700 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Andy is on target here - what is your underlying concern?
With respect to making gawk into a bash loadable builting, feel free
to give it a go.
Arnold
"Andrew J. Schorr" <address@hidden> wrote:
> 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