Joerg Schilling wrote:
> "Garrett D'Amore" <[EMAIL PROTECTED]> wrote:
> > >> I just don't see the "why" here.
> > >>
> > >> Sure, one /could/ do all sorts of spiffy things at build time iff one
> > >> could just use ksh93.
> > >>
> > >> But, I don't see anything in the ON tree today that /requires/ the use
> > >> of ksh93.
> 
> > I see one possible justification for this, which is that with ksh93 you
> > have a much larger vocabulary that doesn't require the use of external
> > programs (i.e. it saves fork/exec.)
> 
> Most saves in fork/exec are done by using simple command lines as dmake does
> not call the shell in case that no shell special characters are found in the
> command line.

Mhhh... but there are cases where running a shell (with builtins) is
cheaper.
For example (just a simplified example, I know that this is not
perfect):
-- snip --
clobber:
        rm b/a.x
        rm b/b.x
        rm b/c.x
        rm b/d.x
        rm b/z.x
        rmdir b
-- snip --
|fork()|s six children (five "rm" and one "rmdir").

Assuming "rm" and "rmdir" are builtin commands in the current shell the
following would be faster:
-- snip --
clobber:
        rm b/a.x ; \
        rm b/b.x ; \
        rm b/c.x ; \
        rm b/d.x ; \
        rm b/z.x ; \
        rmdir b
-- snip --
... in this case only the shell gets started once and then executes six
builtin commands.

> > If this can remove any external subprocesses from being called, it can
> > have a significant performance impact.  (At one point, someone figured
> > that removing a :sh= from one of the top-level Makefiles saved several
> > hours from build times.  This was a long time (5+ years?) ago.
> 
> The build time for ON on a recent machine is less than one hour....

... and some people have machines which need more than a day to crawl
over the tree.

> If :sh= really takes a lot of the build time, then someone should take
> care of enhanding dmake

One option may be to use libshell and create subshells for each command
which is executed (e.g. libshell doesn't call |fork()| unless an
external command is executed and even that would run much faster since
the shell is already set-up and running), e.g  instead of "sh -c
'executable_string'" you just call |sh_trap(shc, "(executable_string)",
...)| (note the '('/')' around "executable_string" to make sure any
variables set(changes/etc. to not affect anything outside the current
shell level).

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to