1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-01 17:00:36 +00:00
freebsd/bin/sh
Jilles Tjoelker bd9b38d1f7 sh: Don't allocate a redirtab if there are no redirections.
Builtins (including variable assignments without command word), function
calls and redirected compound commands need to restore file descriptors
to their original state after execution. This is handled by allocating a
redirtab structure. These mallocs and frees show up heavily in pmcstat.

Only allocate a redirtab if there are actually redirections and maintain a
count of how many levels of REDIR_PUSH there are without redirtabs.

A simple loop without external programs like

sh -c 'i=0; w=$(printf %0100d 7); while [ "$i" -lt 1000000 ]; do
    i=$((i+1)); done'

is over 25% faster on an amd64 bhyve VM.
2016-01-30 21:21:25 +00:00
..
bltin
funcs
tests sh: Clean a readonly local, even if the variable does not exist outside. 2016-01-22 20:10:08 +00:00
alias.c
alias.h
arith_yacc.c
arith_yacc.h
arith_yylex.c
arith.h
builtins.def wordexp: Rewrite to make WRDE_NOCMD reliable. 2015-09-30 21:32:29 +00:00
cd.c sh: Remove a global variable from cd.c. 2016-01-24 17:01:34 +00:00
cd.h
error.c
error.h
eval.c sh: Update associated state when restoring locals while leaving a function. 2016-01-10 16:31:28 +00:00
eval.h sh: Make struct arglist an array instead of a linked list. 2015-10-11 21:33:00 +00:00
exec.c sh: Reduce size of builtins table. 2016-01-03 21:30:22 +00:00
exec.h
expand.c sh: Constify internal representation in expand.c. 2016-01-24 22:26:25 +00:00
expand.h sh: Perform pathname generation during the first expansion phases. 2015-12-31 18:47:54 +00:00
histedit.c
input.c
input.h
jobs.c
jobs.h
mail.c
mail.h
main.c
main.h
Makefile
Makefile.depend
memalloc.c
memalloc.h
miscbltin.c sh: Fix read with escaped IFS characters at the end. 2015-08-30 17:24:22 +00:00
mkbuiltins sh: Reduce size of builtins table. 2016-01-03 21:30:22 +00:00
mknodes.c sh/mknodes: Close files and check for errors when writing. 2015-12-20 16:40:36 +00:00
mksyntax.c
mktokens
myhistedit.h
mystring.c
mystring.h
nodes.c.pat sh: Remove global state from nodes.c. 2015-11-24 22:47:19 +00:00
nodetypes
options.c sh: Simplify some code related to positional parameters. 2016-01-19 22:41:26 +00:00
options.h sh: Simplify some code related to positional parameters. 2016-01-19 22:41:26 +00:00
output.c
output.h
parser.c wordexp: Rewrite to make WRDE_NOCMD reliable. 2015-09-30 21:32:29 +00:00
parser.h wordexp: Rewrite to make WRDE_NOCMD reliable. 2015-09-30 21:32:29 +00:00
redir.c sh: Don't allocate a redirtab if there are no redirections. 2016-01-30 21:21:25 +00:00
redir.h
sh.1 sh(1): Document 'cd -'. 2016-01-30 20:10:20 +00:00
shell.h
show.c
show.h
TOUR
trap.c
trap.h
var.c sh: Clean a readonly local, even if the variable does not exist outside. 2016-01-22 20:10:08 +00:00
var.h sh: Make struct arglist an array instead of a linked list. 2015-10-11 21:33:00 +00:00