From 4778a2a62f878318ece6d76e3125156f02e5fc79 Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 1 Jul 2012 15:55:00 +0000 Subject: [PATCH] =?UTF-8?q?lesson=20learned=20from=20http://k1024.org/~ius?= =?UTF-8?q?ty/blog/entry/perf-null/=20=E2=80=93=20add=20-DMKSH=5FSMALL=5FB?= =?UTF-8?q?UT=5FFAST=20which=20gives=20more=20speed=20(8/20K=20less=20cycl?= =?UTF-8?q?es,=205/9K=20less=20insns,=201.8/2.4k=20less=20branches,=2065/2?= =?UTF-8?q?75=20less=20branch=20misses)=20on=20Debian/amd64=20(klibc-stati?= =?UTF-8?q?c/eglibc)=20at=20cost=20of=200/2=20more=20page=20faults=20and?= =?UTF-8?q?=206K/6K=20more=20text=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build.sh | 5 +++-- check.t | 6 +++--- edit.c | 4 ++-- lex.c | 4 ++-- misc.c | 4 ++-- sh.h | 10 +++++----- shf.c | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Build.sh b/Build.sh index 2f76271..f19a316 100644 --- a/Build.sh +++ b/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 diff --git a/check.t b/check.t index 47c1ef7..a9469bd 100644 --- a/check.t +++ b/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: diff --git a/edit.c b/edit.c index a2ac826..a75cba2 100644 --- a/edit.c +++ b/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) diff --git a/lex.c b/lex.c index cd8bdfb..8682f1a 100644 --- a/lex.c +++ b/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 diff --git a/misc.c b/misc.c index 2917d46..fb8e8e7 100644 --- a/misc.c +++ b/misc.c @@ -30,7 +30,7 @@ #include #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) { diff --git a/sh.h b/sh.h index 66b95bc..b114659 100644 --- a/sh.h +++ b/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 diff --git a/shf.c b/shf.c index 175d332..a3a3b07 100644 --- a/shf.c +++ b/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) {