forked from oils-for-unix/oils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpretty-benchmark.sh
executable file
·60 lines (48 loc) · 1.11 KB
/
pretty-benchmark.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
#
# Usage:
# data_lang/pretty-benchmark.sh <function name>
set -o nounset
set -o pipefail
set -o errexit
# Only show real time
TIMEFORMAT='%R'
# User time is also interesting
# TIMEFORMAT='%U'
# It takes much longer to print than to parse.
#
# Output example:
#
# benchmarks/testdata/configure-coreutils - parsing only, then parsing and printing
# AST not printed.
# 0.129
#
# 108811544 # <-- This is 109 MB of output text!
# 3.679
compare() {
local osh=_bin/cxx-opt/osh
ninja $osh
for file in benchmarks/testdata/*; do
echo ---
echo "$file - parsing only, then parsing and printing"
# Don't print at all. configure-coreutils is 136 ms.
time $osh --ast-format none --tool syntax-tree $file
echo
# Print the whole thing
time $osh --ast-format text --tool syntax-tree $file | wc --bytes
echo
done
}
float-demo() {
### Test of tabular floats - not a test or a benchmark right now
# Note: this could change if we change how floats are printed, e.g. strtof
# vs. strtod.
bin/ysh -c '
var L = []
for i in (1 .. 200) {
call L->append(i/3)
}
= L
'
}
"$@"