From a913702b635766d1644da007572b0335355b62ec Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Thu, 1 Jun 2023 18:15:42 +0200 Subject: [PATCH] Add more benchmarks --- benchmarks/benchmarks/load_completions.fish | 12 ++++++++++++ benchmarks/benchmarks/no_execute.fish | 6 ++++++ benchmarks/benchmarks/printf-escapes.fish | 1 + benchmarks/benchmarks/printf.fish | 5 +++++ benchmarks/benchmarks/read.fish | 7 +++++++ benchmarks/benchmarks/set_long.fish | 3 +++ benchmarks/benchmarks/string-repeat.fish | 3 +++ benchmarks/benchmarks/string-wildcard.fish | 3 +++ benchmarks/benchmarks/string.fish | 3 +++ 9 files changed, 43 insertions(+) create mode 100644 benchmarks/benchmarks/load_completions.fish create mode 100644 benchmarks/benchmarks/no_execute.fish create mode 100644 benchmarks/benchmarks/printf-escapes.fish create mode 100644 benchmarks/benchmarks/printf.fish create mode 100644 benchmarks/benchmarks/read.fish create mode 100644 benchmarks/benchmarks/set_long.fish create mode 100644 benchmarks/benchmarks/string-repeat.fish create mode 100644 benchmarks/benchmarks/string-wildcard.fish create mode 100644 benchmarks/benchmarks/string.fish diff --git a/benchmarks/benchmarks/load_completions.fish b/benchmarks/benchmarks/load_completions.fish new file mode 100644 index 000000000..504dcb47f --- /dev/null +++ b/benchmarks/benchmarks/load_completions.fish @@ -0,0 +1,12 @@ +set -l compdir (status dirname)/../../share/completions +cd $compdir +for file in *.fish + set -l bname (string replace -r '.fish$' '' -- $file) + if type -q $bname + source $file >/dev/null + if test $status -gt 0 + echo FAILING FILE $file + end + end + +end diff --git a/benchmarks/benchmarks/no_execute.fish b/benchmarks/benchmarks/no_execute.fish new file mode 100644 index 000000000..633826c0b --- /dev/null +++ b/benchmarks/benchmarks/no_execute.fish @@ -0,0 +1,6 @@ +set -l path (status dirname) +set -l fish (status fish-path) +for f in (seq 100) + echo $fish -n $path/aliases.fish + $fish -n $path/aliases.fish +end diff --git a/benchmarks/benchmarks/printf-escapes.fish b/benchmarks/benchmarks/printf-escapes.fish new file mode 100644 index 000000000..c882ed0bb --- /dev/null +++ b/benchmarks/benchmarks/printf-escapes.fish @@ -0,0 +1 @@ +printf (string repeat -n 200 \\x7f)%s\n (string repeat -n 2000 aaa\n) diff --git a/benchmarks/benchmarks/printf.fish b/benchmarks/benchmarks/printf.fish new file mode 100644 index 000000000..9b1887990 --- /dev/null +++ b/benchmarks/benchmarks/printf.fish @@ -0,0 +1,5 @@ +for i in (seq 100000) + printf '%f\n' $i.$i +end + +exit 0 diff --git a/benchmarks/benchmarks/read.fish b/benchmarks/benchmarks/read.fish new file mode 100644 index 000000000..de86c5ef3 --- /dev/null +++ b/benchmarks/benchmarks/read.fish @@ -0,0 +1,7 @@ +set -l tmp (mktemp) +string repeat -n 2000 >$tmp +for i in (seq 1000) + cat $tmp | read -l foo +end + +true diff --git a/benchmarks/benchmarks/set_long.fish b/benchmarks/benchmarks/set_long.fish new file mode 100644 index 000000000..4b6b2e19c --- /dev/null +++ b/benchmarks/benchmarks/set_long.fish @@ -0,0 +1,3 @@ +for abc in (seq 100000) + set -l def +end diff --git a/benchmarks/benchmarks/string-repeat.fish b/benchmarks/benchmarks/string-repeat.fish new file mode 100644 index 000000000..38af9119d --- /dev/null +++ b/benchmarks/benchmarks/string-repeat.fish @@ -0,0 +1,3 @@ +for i in (string repeat -n 100 \n) + string repeat -n 50000 a\n +end diff --git a/benchmarks/benchmarks/string-wildcard.fish b/benchmarks/benchmarks/string-wildcard.fish new file mode 100644 index 000000000..12590f0ab --- /dev/null +++ b/benchmarks/benchmarks/string-wildcard.fish @@ -0,0 +1,3 @@ +for i in (seq 100000) + string match '*o' fooooooo +end diff --git a/benchmarks/benchmarks/string.fish b/benchmarks/benchmarks/string.fish new file mode 100644 index 000000000..94baebbc1 --- /dev/null +++ b/benchmarks/benchmarks/string.fish @@ -0,0 +1,3 @@ +for i in (seq 100000) + string match -r '^.*$' fooooooo +end | string match -re o