lesson learned from http://k1024.org/~iusty/blog/entry/perf-null/ – add -DMKSH_SMALL_BUT_FAST which gives more speed (8/20K less cycles, 5/9K less insns, 1.8/2.4k less branches, 65/275 less branch misses) on Debian/amd64 (klibc-static/eglibc) at cost of 0/2 more page faults and 6K/6K more text size
This commit is contained in:
parent
798cfdc982
commit
4778a2a62f
5
Build.sh
5
Build.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.578 2012/07/01 15:51:24 tg Exp $'
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.579 2012/07/01 15:54:49 tg Exp $'
|
||||
#-
|
||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012
|
||||
@ -1486,7 +1486,7 @@ else
|
||||
#define EXTERN
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.578 2012/07/01 15:51:24 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.579 2012/07/01 15:54:49 tg Exp $");
|
||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||
EOF
|
||||
case $cm in
|
||||
@ -2285,6 +2285,7 @@ MKSH_NO_LIMITS omit ulimit code
|
||||
MKSH_NO_SIGSETJMP define if sigsetjmp is broken or not available
|
||||
MKSH_NO_SIGSUSPEND use sigprocmask+pause instead of sigsuspend
|
||||
MKSH_SMALL omit some code, optimise hard for size (slower)
|
||||
MKSH_SMALL_BUT_FAST disable some hard-for-size optim. (modern sys.)
|
||||
MKSH_S_NOVI=1 disable Vi editing mode (default if MKSH_SMALL)
|
||||
MKSH_TYPEDEF_SIG_ATOMIC_T define to e.g. 'int' if sig_atomic_t is missing
|
||||
MKSH_TYPEDEF_SSIZE_T define to e.g. 'long' if your OS has no ssize_t
|
||||
|
6
check.t
6
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.549 2012/06/28 20:17:35 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.550 2012/07/01 15:54:51 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
@ -29,7 +29,7 @@
|
||||
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R40 2012/06/28
|
||||
@(#)MIRBSD KSH R40 2012/07/01
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
@ -38,7 +38,7 @@ name: KSH_VERSION
|
||||
category: shell:legacy-no
|
||||
---
|
||||
expected-stdout:
|
||||
@(#)LEGACY KSH R40 2012/06/28
|
||||
@(#)LEGACY KSH R40 2012/07/01
|
||||
description:
|
||||
Check version of legacy shell.
|
||||
stdin:
|
||||
|
4
edit.c
4
edit.c
@ -28,7 +28,7 @@
|
||||
|
||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.238 2012/07/01 15:36:18 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.239 2012/07/01 15:54:53 tg Exp $");
|
||||
|
||||
/*
|
||||
* in later versions we might use libtermcap for this, but since external
|
||||
@ -88,7 +88,7 @@ static int x_vi(char *, size_t);
|
||||
#endif
|
||||
|
||||
#define x_flush() shf_flush(shl_out)
|
||||
#ifdef MKSH_SMALL
|
||||
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
|
||||
#define x_putc(c) x_putcf(c)
|
||||
#else
|
||||
#define x_putc(c) shf_putc((c), shl_out)
|
||||
|
4
lex.c
4
lex.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.164 2012/06/28 20:05:07 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.165 2012/07/01 15:54:55 tg Exp $");
|
||||
|
||||
/*
|
||||
* states while lexing word
|
||||
@ -131,7 +131,7 @@ short subshell_nesting_level = 0;
|
||||
return (cev); \
|
||||
}
|
||||
|
||||
#ifdef MKSH_SMALL
|
||||
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
|
||||
static int getsc(void);
|
||||
|
||||
static int
|
||||
|
4
misc.c
4
misc.c
@ -30,7 +30,7 @@
|
||||
#include <grp.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.194 2012/06/26 19:22:19 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.195 2012/07/01 15:54:56 tg Exp $");
|
||||
|
||||
#define KSH_CHVT_FLAG
|
||||
#ifdef MKSH_SMALL
|
||||
@ -2006,7 +2006,7 @@ strstr(char *b, const char *l)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MKSH_SMALL
|
||||
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
|
||||
char *
|
||||
strndup_i(const char *src, size_t len, Area *ap)
|
||||
{
|
||||
|
10
sh.h
10
sh.h
@ -157,9 +157,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.571 2012/07/01 15:44:31 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.572 2012/07/01 15:54:57 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R40 2012/06/28"
|
||||
#define MKSH_VERSION "R40 2012/07/01"
|
||||
|
||||
/* arithmetic types: C implementation */
|
||||
#if !HAVE_CAN_INTTYPES
|
||||
@ -498,7 +498,7 @@ im_sorry_dave(void)
|
||||
(dst) = (src) + utf_ptradj(src); \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
#ifdef MKSH_SMALL
|
||||
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
|
||||
#define strdupx(d, s, ap) do { \
|
||||
(d) = strdup_i((s), (ap)); \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
@ -1859,7 +1859,7 @@ char *do_realpath(const char *);
|
||||
void simplify_path(char *);
|
||||
void set_current_wd(const char *);
|
||||
int c_cd(const char **);
|
||||
#ifdef MKSH_SMALL
|
||||
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
|
||||
char *strdup_i(const char *, Area *);
|
||||
char *strndup_i(const char *, size_t, Area *);
|
||||
#endif
|
||||
@ -1877,7 +1877,7 @@ ssize_t shf_read(char *, ssize_t, struct shf *);
|
||||
char *shf_getse(char *, ssize_t, struct shf *);
|
||||
int shf_getchar(struct shf *s);
|
||||
int shf_ungetc(int, struct shf *);
|
||||
#ifdef MKSH_SMALL
|
||||
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
|
||||
int shf_getc(struct shf *);
|
||||
int shf_putc(int, struct shf *);
|
||||
#else
|
||||
|
4
shf.c
4
shf.c
@ -24,7 +24,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.45 2011/10/25 22:36:38 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.46 2012/07/01 15:55:00 tg Exp $");
|
||||
|
||||
/* flags to shf_emptybuf() */
|
||||
#define EB_READSW 0x01 /* about to switch to reading */
|
||||
@ -1042,7 +1042,7 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
|
||||
return (shf_error(shf) ? EOF : nwritten);
|
||||
}
|
||||
|
||||
#ifdef MKSH_SMALL
|
||||
#if defined(MKSH_SMALL) && !defined(MKSH_SMALL_BUT_FAST)
|
||||
int
|
||||
shf_getc(struct shf *shf)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user