Effect on speed of comments in bash script loops?
Scott Elcomb
psema4-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Nov 15 20:37:13 UTC 2012
On Thu, Nov 15, 2012 at 3:27 PM, Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org> wrote:
> Assume a bash script crunching through a large text file, with an
> inner loop that gets called a lot. I like to heavily comment complex
> scripts, so 6 months later I don't have to spend days trying to figure
> out what they do. Are the comments parsed+discarded on each pass
> through the loop? If necessary, I could keep a commented "master"
> script and an uncommented "working" script, like so...
>
> echo '#!/bin/bash' > working
> grep -v "^#" master >> working
> chmod 744 working
>
> The working script would execute the same as the commented master
> script, but possibly faster.
i pretty sure there'll be better answers from more knowledgeable folks
but I'm curious... is there a noticeable difference in execution
times?
time /path/to/master
time /path/to/working
--
Scott Elcomb
@psema4 on Twitter / Identi.ca / Github & more
Atomic OS: Self Contained Microsystems
http://code.google.com/p/atomos/
Member of the Pirate Party of Canada
http://www.pirateparty.ca/
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list