Skip to content

Commit 6dada14

Browse files
[benchmarking] Minor updates to better support benchmarking.
1 parent 37e88d6 commit 6dada14

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

scripts/examples.z-run

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@
3232
:: examples / export-library-fingerprint :: exec -- "${ZRUN[@]}" ':: examples / exec' export-library-fingerprint "${@}"
3333

3434
:: examples / parse-library :: exec -- "${ZRUN[@]}" ':: examples / exec' parse-library "${@}"
35+
:: examples / parse-library / without-output :: exec -- "${ZRUN[@]}" ':: examples / exec' parse-library-without-output "${@}"
3536

36-
:: examples / exec :: exec -- "${ZRUN[@]}" ':: run / exec' "${@}"
37+
38+
39+
40+
<< examples / exec
41+
export -- __RUN_LIBRARY_SOURCE="${__RUN_LIBRARY_SOURCE:-./examples/_z-run}"
42+
exec -- "${ZRUN[@]}" ':: run / exec' "${@}"
43+
!!
3744

3845

3946

scripts/run.z-run

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
;;&
7979
( all | cpu | memory )
8080
;;
81-
( hyperfine | time )
81+
( hyperfine | hyperfine-with-output | time )
8282
;;
8383
( * )
8484
printf -- '[ee] invalid run profile `%s`; aborting!\n' "${_profile}" >&2
@@ -138,22 +138,23 @@
138138

139139
if test -n "${__RUN_LIBRARY_SOURCE:-}" ; then
140140
export -- ZRUN_LIBRARY_SOURCE="${__RUN_LIBRARY_SOURCE}"
141-
else
142-
export -- ZRUN_LIBRARY_SOURCE=./examples/z-run
143141
fi
144142
export -n -- __RUN_LIBRARY_SOURCE=
145143

146144
case "${_profile}" in
147-
( hyperfine )
145+
( hyperfine | hyperfine-with-output )
148146
_wrapper=(
149147
hyperfine
150148
--warmup 5
151149
--min-runs 10
152150
--max-runs 100
153151
--shell ''
154152
--command-name z-run
155-
--
156153
)
154+
if test "${_profile}" == hyperfine-with-output ; then
155+
_wrapper+=( --show-output )
156+
fi
157+
_wrapper+=( -- )
157158
exec -- "${_wrapper[@]}" "${_command[*]@Q}"
158159
;;
159160
( time )
@@ -187,6 +188,7 @@
187188
:: use / run / profile / memory :: export -- __RUN_PROFILE=memory
188189
:: use / run / profile / time :: export -- __RUN_PROFILE=time
189190
:: use / run / profile / hyperfine :: export -- __RUN_PROFILE=hyperfine
191+
:: use / run / profile / hyperfine / with-output :: export -- __RUN_PROFILE=hyperfine-with-output
190192

191193
:: use / run / term / enable :: export -- __RUN_TERM="${TERM}"
192194
:: use / run / term / disable :: export -- __RUN_TERM=dumb

sources/lib/main.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ func Main (_executable string, _argument0 string, _arguments []string, _environm
310310
case "parse-library" :
311311
_command = "parse-library"
312312

313+
case "parse-library-without-output" :
314+
_command = "parse-library-without-output"
315+
313316
case "export-library-json" :
314317
_command = "export-library-json"
315318

@@ -434,7 +437,7 @@ func Main (_executable string, _argument0 string, _arguments []string, _environm
434437
}
435438

436439
_cacheEnabled := true
437-
if _command == "parse-library" {
440+
if (_command == "parse-library") || (_command == "parse-library-without-output") {
438441
_cacheEnabled = false
439442
}
440443
if _cacheEnabled {
@@ -674,11 +677,15 @@ func Main (_executable string, _argument0 string, _arguments []string, _environm
674677
return doExportScriptletLabels (_library, os.Stdout, _context)
675678

676679

677-
case "parse-library" :
680+
case "parse-library", "parse-library-without-output" :
678681
if (_scriptlet != "") || (len (_cleanArguments) != 0) {
679682
return errorf (0x400ec122, "export: unexpected scriptlet or arguments")
680683
}
681-
return doExportLibraryJson (_library, os.Stdout, _context)
684+
if _command == "parse-library" {
685+
return doExportLibraryJson (_library, os.Stdout, _context)
686+
} else {
687+
return nil
688+
}
682689

683690
case "export-library-json" :
684691
if (_scriptlet != "") || (len (_cleanArguments) != 0) {

0 commit comments

Comments
 (0)