git: sh: Use vfork in a few common cases.

Peter Avalos pavalos at crater.dragonflybsd.org
Sun Feb 5 13:05:30 PST 2012


commit 3fb5edd5046fcd04f359351f47e70ad37816977a
Author: Peter Avalos <pavalos at dragonflybsd.org>
Date:   Sun Feb 5 12:21:25 2012 -0800

    sh: Use vfork in a few common cases.
    
    This uses vfork() for simple commands and command substitutions containing a
    single simple command, invoking an external program under certain conditions
    (no redirections or variable assignments, non-interactive shell, no job
    control). These restrictions limit the amount of code executed in a vforked
    child.
    
    There is a large speedup (for example 35%) in microbenchmarks. The
    difference in buildkernel is smaller (for example 0.5%) but still
    statistically significant. See
    http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html
    for some numbers.
    
    The use of vfork() can be disabled by setting a variable named
    SH_DISABLE_VFORK.
    
    Obtained-from:  FreeBSD 230998

Summary of changes:
 bin/sh/eval.c |   11 ++++++++++-
 bin/sh/jobs.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 bin/sh/jobs.h |    3 ++-
 bin/sh/var.c  |    5 ++++-
 bin/sh/var.h  |    4 +++-
 5 files changed, 69 insertions(+), 5 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3fb5edd5046fcd04f359351f47e70ad37816977a


-- 
DragonFly BSD source repository





More information about the Commits mailing list