From owner-dev-commits-ports-main@freebsd.org Thu Sep 23 10:21:31 2021 Return-Path: Delivered-To: dev-commits-ports-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9277A67CBB4; Thu, 23 Sep 2021 10:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HFWRH3cS0z3vhs; Thu, 23 Sep 2021 10:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D48C2940B; Thu, 23 Sep 2021 10:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18NALVWw015204; Thu, 23 Sep 2021 10:21:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18NALVgq015203; Thu, 23 Sep 2021 10:21:31 GMT (envelope-from git) Date: Thu, 23 Sep 2021 10:21:31 GMT Message-Id: <202109231021.18NALVgq015203@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: 05857c1ba030 - main - benchmarks/shellbench: add new port MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05857c1ba0303241bbd497f3e21930c4fe23111c Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the main branch of the FreeBSD ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 10:21:31 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/ports/commit/?id=05857c1ba0303241bbd497f3e21930c4fe23111c commit 05857c1ba0303241bbd497f3e21930c4fe23111c Author: Stefan Eßer AuthorDate: 2021-09-23 10:17:26 +0000 Commit: Stefan Eßer CommitDate: 2021-09-23 10:21:21 +0000 benchmarks/shellbench: add new port This program allows to compare the performance of different POSIX shells (e.g. sh, bash, dash, ksh, zsh, ...). A number of sample scripts are included and can be easily extended to cover more areas. --- benchmarks/Makefile | 1 + benchmarks/shellbench/Makefile | 29 ++++++++++ benchmarks/shellbench/distinfo | 3 ++ benchmarks/shellbench/files/patch-shellbench | 80 ++++++++++++++++++++++++++++ benchmarks/shellbench/pkg-descr | 7 +++ benchmarks/shellbench/pkg-plist | 10 ++++ 6 files changed, 130 insertions(+) diff --git a/benchmarks/Makefile b/benchmarks/Makefile index d45d58ee2676..511849625cf8 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -85,6 +85,7 @@ SUBDIR += scimark2c SUBDIR += siege SUBDIR += sipp + SUBDIR += shellbench SUBDIR += slowloris SUBDIR += smhasher SUBDIR += spp diff --git a/benchmarks/shellbench/Makefile b/benchmarks/shellbench/Makefile new file mode 100644 index 000000000000..872e8bd8c507 --- /dev/null +++ b/benchmarks/shellbench/Makefile @@ -0,0 +1,29 @@ +PORTNAME= shellbench +PORTVERSION= 20200806 +CATEGORIES= benchmarks + +MAINTAINER= se@FreeBSD.org +COMMENT= Benchmark utility for POSIX shell comparison + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USE_GITHUB= yes +GH_ACCOUNT= shellspec +GH_TAGNAME= ce43ba49d3 + +NO_ARCH= yes +NO_BUILD= yes + +OPTIONS_DEFINE= DOCS + +do-install: + ${REINPLACE_CMD} 's:%%DATADIR%%:${DATADIR}:g' ${WRKSRC}/shellbench + ${REINPLACE_CMD} 's:%%DOCSDIR%%:${DOCSDIR}:g' ${WRKSRC}/shellbench + ${INSTALL_SCRIPT} ${WRKSRC}/shellbench ${STAGEDIR}${PREFIX}/bin + ${MKDIR} ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${WRKSRC}/sample/* ${STAGEDIR}${DATADIR}/ + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}/ + +.include diff --git a/benchmarks/shellbench/distinfo b/benchmarks/shellbench/distinfo new file mode 100644 index 000000000000..a51ec99c57a6 --- /dev/null +++ b/benchmarks/shellbench/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1632383851 +SHA256 (shellspec-shellbench-20200806-ce43ba49d3_GH0.tar.gz) = 84abc9341c79092c1818d5f8bfa72566374fb011550b969c86d2f3bef23a5e4f +SIZE (shellspec-shellbench-20200806-ce43ba49d3_GH0.tar.gz) = 7379 diff --git a/benchmarks/shellbench/files/patch-shellbench b/benchmarks/shellbench/files/patch-shellbench new file mode 100644 index 000000000000..7a110cc447e1 --- /dev/null +++ b/benchmarks/shellbench/files/patch-shellbench @@ -0,0 +1,80 @@ +--- shellbench.orig 2020-08-06 15:07:20 UTC ++++ shellbench +@@ -12,6 +12,8 @@ COUNT_WIDTH=${SHELLBENCH_COUNT_WIDTH:-10} + SHOW_ERROR='' + CORRECTION_MODE='' + NULLLOOP_COUNT='' ++ALL_SAMPLES='' ++SAMPLE_DIR=%%DATADIR%% + + usage() { + cat< 0) [default: 3] + -w, --warmup SECONDS Benchmark preparation time. (SECONDS > 0) [default: 1] ++ -a, --allsamples Execute all sample scripts + -c, --correct Enable correction mode to eliminate loop overhead. + -e, --error Display error details. + -h, --help You're looking at it. ++ -l, --listsamples List names of the sample scripts ++ ++The sample scripts can be found in %%DATADIR%% . + HERE ++if [ -r "%%DOCSDIR%%/README.md" ]; then ++cat<&2; exit 1; } + unknown() { abort "Unrecognized option '$1'"; } + required() { [ $# -gt 1 ] || abort "Option '$1' requires an argument"; } +@@ -327,9 +346,11 @@ parse_options() { + -s | --shell ) required "$@" && shift; SHELLS=$1 ;; + -t | --time ) required "$@" && shift; BENCHMARK_TIME=$1 ;; + -w | --warmup ) required "$@" && shift; WARMUP_TIME=$1 ;; ++ -a | --allsamples ) ALL_SAMPLES=1 ;; + -c | --correct) CORRECTION_MODE=1 ;; + -e | --error ) SHOW_ERROR=1 ;; + -h | --help ) usage; exit ;; ++ -l | --listsamples ) list_samples; exit ;; + --) shift; params PARAMS $(($OPTIND - $#)) $OPTIND; break ;; + -?*) unknown "$@" ;; + *) param PARAMS $(($OPTIND - $#)) +@@ -342,6 +363,11 @@ ${__SOURCED__:+return} + + trap '' HUP + parse_options "$@" ++ ++[ "$ALL_SAMPLES" ] && all_samples ++ ++[ -z "$PARAMS" ] && { usage; exit; } ++ + eval "set -- $PARAMS" + + [ "$CORRECTION_MODE" ] && NULLLOOP_COUNT=${SHELLBENCH_NULLLOOP_COUNT:-} +@@ -352,6 +378,9 @@ display_header "$SHELLS" + $(printf '%s\n' '#bench "loop only"' '@begin' '@end' | preprocess) + HERE + for file in "$@"; do ++ [ -r "$file" ] || if [ -r "%%DATADIR%%/$file" ]; then ++ file="%%DATADIR%%/$file" ++ fi + preprocess < "$file" | process "${file##*/}" + done + display_footer diff --git a/benchmarks/shellbench/pkg-descr b/benchmarks/shellbench/pkg-descr new file mode 100644 index 000000000000..029454588e05 --- /dev/null +++ b/benchmarks/shellbench/pkg-descr @@ -0,0 +1,7 @@ +Shellbench is a benchmark utility for POSIX shell comparison. + +It allows to compare the performance of shell commands and operations +and comes with a set of sample scripts. Supported shells are sh, bash, +dash, ksh, zsh and many more. + +WWW: https://github.com/shellspec/shellbench diff --git a/benchmarks/shellbench/pkg-plist b/benchmarks/shellbench/pkg-plist new file mode 100644 index 000000000000..cad1436c8071 --- /dev/null +++ b/benchmarks/shellbench/pkg-plist @@ -0,0 +1,10 @@ +bin/shellbench +%%PORTDOCS%%%%DOCSDIR%%/README.md +%%DATADIR%%/assign.sh +%%DATADIR%%/cmp.sh +%%DATADIR%%/count.sh +%%DATADIR%%/eval.sh +%%DATADIR%%/func.sh +%%DATADIR%%/null.sh +%%DATADIR%%/output.sh +%%DATADIR%%/subshell.sh