git.delta.rocks / jrsonnet / refs/commits / 81f09984e81d

difftreelog

ci fix omitSource

Yaroslav Bolyukin2022-12-03parent: #62ffdd8.patch.diff
in: master

1 file changed

modifiednix/benchmarks.nixdiffbeforeafterboth
7171
72 installPhase =72 installPhase =
73 let73 let
74 mkBench = { name, path, omitSource ? false, pathIsGenerator ? false, skipScala ? "", skipCpp ? "", skipGo ? "", vendor ? "" }: ''74 mkBench = { name, path, omitSource ? false, pathIsGenerator ? false, skipScala ? "", skipCpp ? "", skipGo ? "", vendor ? "" }: ''
75 set -oux75 set -oux
7676
77 echo >> $out77 echo >> $out
78 echo "### ${name}" >> $out78 echo "### ${name}" >> $out
79 echo >> $out79 echo >> $out
80 ${if skipGo != "" then ''80 ${if skipGo != "" then ''
81 echo "> Note: No results for Go, ${skipGo}" >> $out81 echo "> Note: No results for Go, ${skipGo}" >> $out
82 echo >> $out82 echo >> $out
83 '' else ""}83 '' else ""}
84 ${if skipScala != "" then ''84 ${if skipScala != "" then ''
85 echo "> Note: No results for Scala, ${skipScala}" >> $out85 echo "> Note: No results for Scala, ${skipScala}" >> $out
86 echo >> $out86 echo >> $out
87 '' else ""}87 '' else ""}
88 ${if skipCpp != "" then ''88 ${if skipCpp != "" then ''
89 echo "> Note: No results for C++, ${skipCpp}" >> $out89 echo "> Note: No results for C++, ${skipCpp}" >> $out
90 echo >> $out90 echo >> $out
91 '' else ""}91 '' else ""}
92 echo "<details>" >> $out92 echo "<details>" >> $out
93 echo "<summary>Source</summary>" >> $out93 echo "<summary>Source</summary>" >> $out
94 echo >> $out94 echo >> $out
95 echo "\`\`\`jsonnet" >> $out95 echo "\`\`\`jsonnet" >> $out
96 ${if pathIsGenerator then "echo \"// Generator source\" >> $out" else ""}96 ${if pathIsGenerator then "echo \"// Generator source\" >> $out" else ""}
97 cat ${if omitSource then "// Omitted: too large" else path} >> $out97 ${if omitSource then "echo \"// Omitted: too large\" >> $out" else "cat ${path} >> $out"}
98 echo >> $out98 echo >> $out
99 echo "\`\`\`" >> $out99 echo "\`\`\`" >> $out
100 echo "</details>" >> $out100 echo "</details>" >> $out
101 echo >> $out101 echo >> $out
102 path=${path}102 path=${path}
103 ${if pathIsGenerator then ''103 ${if pathIsGenerator then ''
104 jrsonnet $path > generated.jsonnet104 jrsonnet $path > generated.jsonnet
105 path=generated.jsonnet105 path=generated.jsonnet
106 '' else ""}106 '' else ""}
107 hyperfine -N ${if quick then "-r1" else ""} --output=pipe --style=basic --export-markdown result.md \107 hyperfine -N ${if quick then "-r1" else ""} --output=pipe --style=basic --export-markdown result.md \
108 "jrsonnet $path ${if vendor != "" then "-J${vendor}" else ""}" -n "Rust" \108 "jrsonnet $path ${if vendor != "" then "-J${vendor}" else ""}" -n "Rust" \
109 ${if skipGo == "" then "\"go-jsonnet $path ${if vendor != "" then "-J ${vendor}" else ""}\" -n \"Go\"" else "" } \109 ${if skipGo == "" then "\"go-jsonnet $path ${if vendor != "" then "-J ${vendor}" else ""}\" -n \"Go\"" else "" } \
110 ${if skipScala == "" then "\"sjsonnet $path ${if vendor != "" then "-J ${vendor}" else ""}\" -n \"Scala\"" else "" } \110 ${if skipScala == "" then "\"sjsonnet $path ${if vendor != "" then "-J ${vendor}" else ""}\" -n \"Scala\"" else "" } \
111 ${if skipCpp == "" then "\"jsonnet $path ${if vendor != "" then "-J ${vendor}" else ""}\" -n \"C++\"" else "" }111 ${if skipCpp == "" then "\"jsonnet $path ${if vendor != "" then "-J ${vendor}" else ""}\" -n \"C++\"" else "" }
112 cat result.md >> $out112 cat result.md >> $out
113 '';113 '';
114 in114 in
115 ''115 ''
116 touch $out116 touch $out
117 cat ${./benchmarks.md} >> $out117 cat ${./benchmarks.md} >> $out
118 echo >> $out118 echo >> $out
119119
120 echo "<details>" >> $out120 echo "<details>" >> $out
121 echo "<summary>Tested versions</summary>" >> $out121 echo "<summary>Tested versions</summary>" >> $out
122 echo >> $out122 echo >> $out
123 echo Rust: git as $(date +'%d.%m.%Y' -u) >> $out123 echo Rust: git as $(date +'%d.%m.%Y' -u) >> $out
124 echo >> $out124 echo >> $out
125 echo "\`\`\`" >> $out125 echo "\`\`\`" >> $out
126 jrsonnet --help >> $out126 jrsonnet --help >> $out
127 echo "\`\`\`" >> $out127 echo "\`\`\`" >> $out
128 echo >> $out128 echo >> $out
129 echo Go: $(go-jsonnet --version) >> $out129 echo Go: $(go-jsonnet --version) >> $out
130 echo >> $out130 echo >> $out
131 echo "\`\`\`" >> $out131 echo "\`\`\`" >> $out
132 go-jsonnet --help >> $out132 go-jsonnet --help >> $out
133 echo "\`\`\`" >> $out133 echo "\`\`\`" >> $out
134 echo >> $out134 echo >> $out
135 echo C++: $(jsonnet --version) >> $out135 echo C++: $(jsonnet --version) >> $out
136 echo >> $out136 echo >> $out
137 echo "\`\`\`" >> $out137 echo "\`\`\`" >> $out
138 jsonnet --help >> $out138 jsonnet --help >> $out
139 echo "\`\`\`" >> $out139 echo "\`\`\`" >> $out
140 echo >> $out140 echo >> $out
141 echo Scala: >> $out141 echo Scala: >> $out
142 echo >> $out142 echo >> $out
143 echo "\`\`\`" >> $out143 echo "\`\`\`" >> $out
144 sjsonnet 2>> $out || true144 sjsonnet 2>> $out || true
145 echo "\`\`\`" >> $out145 echo "\`\`\`" >> $out
146 echo >> $out146 echo >> $out
147 echo "</details>" >> $out147 echo "</details>" >> $out
148 echo >> $out148 echo >> $out
149149
150 echo >> $out150 echo >> $out
151 echo "## Real world" >> $out151 echo "## Real world" >> $out
152 ${mkBench {name = "Graalvm CI"; path = "${graalvmBench}/ci.jsonnet"; skipCpp = skipSlow;}}152 ${mkBench {name = "Graalvm CI"; path = "${graalvmBench}/ci.jsonnet"; skipCpp = "takes longer than a hour";}}
153 ${mkBench {name = "Kube-prometheus manifests"; vendor = "${kubePrometheusBench}/vendor"; path = "${kubePrometheusBench}/example.jsonnet"; skipCpp = skipSlow;}}153 ${mkBench {name = "Kube-prometheus manifests"; vendor = "${kubePrometheusBench}/vendor"; path = "${kubePrometheusBench}/example.jsonnet"; skipCpp = skipSlow;}}
154154
155 echo >> $out155 echo >> $out
156 echo "## Benchmarks from C++ jsonnet (/perf_tests)" >> $out156 echo "## Benchmarks from C++ jsonnet (/perf_tests)" >> $out
157 ${mkBench {name = "Large string join"; path = "${jsonnetBench}/perf_tests/large_string_join.jsonnet";}}157 ${mkBench {name = "Large string join"; path = "${jsonnetBench}/perf_tests/large_string_join.jsonnet";}}
158 ${mkBench {name = "Large string template"; omitSource = true; path = "${jsonnetBench}/perf_tests/large_string_template.jsonnet"; skipGo = "fails with os stack size exhausion"; skipCpp = skipSlow;}}158 ${mkBench {name = "Large string template"; omitSource = true; path = "${jsonnetBench}/perf_tests/large_string_template.jsonnet"; skipGo = "fails with os stack size exhausion"; skipCpp = skipSlow;}}
159 ${mkBench {name = "Realistic 1"; path = "${jsonnetBench}/perf_tests/realistic1.jsonnet"; skipGo = skipSlow; skipCpp = skipSlow;}}159 ${mkBench {name = "Realistic 1"; path = "${jsonnetBench}/perf_tests/realistic1.jsonnet"; skipGo = skipSlow; skipCpp = skipSlow;}}
160 ${mkBench {name = "Realistic 2"; path = "${jsonnetBench}/perf_tests/realistic2.jsonnet"; skipGo = skipSlow; skipCpp = skipSlow;}}160 ${mkBench {name = "Realistic 2"; path = "${jsonnetBench}/perf_tests/realistic2.jsonnet"; skipGo = skipSlow; skipCpp = skipSlow;}}
161161
162 echo >> $out162 echo >> $out
163 echo "## Benchmarks from C++ jsonnet (/benchmarks)" >> $out163 echo "## Benchmarks from C++ jsonnet (/benchmarks)" >> $out
164 ${mkBench {name = "Tail call"; path = "${jsonnetBench}/benchmarks/bench.01.jsonnet";}}164 ${mkBench {name = "Tail call"; path = "${jsonnetBench}/benchmarks/bench.01.jsonnet";}}
165 ${mkBench {name = "Inheritance recursion"; path = "${jsonnetBench}/benchmarks/bench.02.jsonnet"; skipCpp = skipSlow;}}165 ${mkBench {name = "Inheritance recursion"; path = "${jsonnetBench}/benchmarks/bench.02.jsonnet"; skipCpp = skipSlow;}}
166 ${mkBench {name = "Simple recursive call"; path = "${jsonnetBench}/benchmarks/bench.03.jsonnet";}}166 ${mkBench {name = "Simple recursive call"; path = "${jsonnetBench}/benchmarks/bench.03.jsonnet";}}
167 ${mkBench {name = "Foldl string concat"; path = "${jsonnetBench}/benchmarks/bench.04.jsonnet";}}167 ${mkBench {name = "Foldl string concat"; path = "${jsonnetBench}/benchmarks/bench.04.jsonnet";}}
168 ${mkBench {name = "Array sorts"; path = "${jsonnetBench}/benchmarks/bench.06.jsonnet"; skipScala = "std.reverse is not implemented"; skipCpp = skipSlow;}}168 ${mkBench {name = "Array sorts"; path = "${jsonnetBench}/benchmarks/bench.06.jsonnet"; skipScala = "std.reverse is not implemented"; skipCpp = skipSlow;}}
169 ${mkBench {name = "Lazy array"; path = "${jsonnetBench}/benchmarks/bench.07.jsonnet";}}169 ${mkBench {name = "Lazy array"; path = "${jsonnetBench}/benchmarks/bench.07.jsonnet";}}
170 ${mkBench {name = "Inheritance function recursion"; path = "${jsonnetBench}/benchmarks/bench.08.jsonnet";}}170 ${mkBench {name = "Inheritance function recursion"; path = "${jsonnetBench}/benchmarks/bench.08.jsonnet";}}
171 ${mkBench {name = "String strips"; path = "${jsonnetBench}/benchmarks/bench.09.jsonnet"; skipCpp = skipSlow;}}171 ${mkBench {name = "String strips"; path = "${jsonnetBench}/benchmarks/bench.09.jsonnet"; skipCpp = skipSlow;}}
172 ${mkBench {name = "Big object"; path = "${jsonnetBench}/benchmarks/gen_big_object.jsonnet"; pathIsGenerator = true;}}172 ${mkBench {name = "Big object"; path = "${jsonnetBench}/benchmarks/gen_big_object.jsonnet"; pathIsGenerator = true;}}
173173
174 echo >> $out174 echo >> $out
175 echo "## Benchmarks from Go jsonnet (builtins)" >> $out175 echo "## Benchmarks from Go jsonnet (builtins)" >> $out
176 ${mkBench {name = "std.base64"; path = "${goJsonnetBench}/base64.jsonnet"; skipCpp = skipSlow;}}176 ${mkBench {name = "std.base64"; path = "${goJsonnetBench}/base64.jsonnet"; skipCpp = skipSlow;}}
177 ${mkBench {name = "std.base64Decode"; path = "${goJsonnetBench}/base64Decode.jsonnet"; skipCpp = skipSlow;}}177 ${mkBench {name = "std.base64Decode"; path = "${goJsonnetBench}/base64Decode.jsonnet"; skipCpp = skipSlow;}}
178 ${mkBench {name = "std.base64DecodeBytes"; path = "${goJsonnetBench}/base64DecodeBytes.jsonnet"; skipCpp = skipSlow;}}178 ${mkBench {name = "std.base64DecodeBytes"; path = "${goJsonnetBench}/base64DecodeBytes.jsonnet"; skipCpp = skipSlow;}}
179 ${mkBench {name = "std.base64 (byte array)"; path = "${goJsonnetBench}/base64_byte_array.jsonnet"; skipCpp = skipSlow;}}179 ${mkBench {name = "std.base64 (byte array)"; path = "${goJsonnetBench}/base64_byte_array.jsonnet"; skipCpp = skipSlow;}}
180 ${mkBench {name = "std.foldl"; path = "${goJsonnetBench}/foldl.jsonnet";}}180 ${mkBench {name = "std.foldl"; path = "${goJsonnetBench}/foldl.jsonnet";}}
181 ${mkBench {name = "std.manifestJsonEx"; path = "${goJsonnetBench}/manifestJsonEx.jsonnet";}}181 ${mkBench {name = "std.manifestJsonEx"; path = "${goJsonnetBench}/manifestJsonEx.jsonnet";}}
182 ${mkBench {name = "std.manifestTomlEx"; path = "${goJsonnetBench}/manifestTomlEx.jsonnet"; skipScala = "std.manifestTomlEx is not implemented";}}182 ${mkBench {name = "std.manifestTomlEx"; path = "${goJsonnetBench}/manifestTomlEx.jsonnet"; skipScala = "std.manifestTomlEx is not implemented";}}
183 ${mkBench {name = "std.parseInt"; path = "${goJsonnetBench}/parseInt.jsonnet";}}183 ${mkBench {name = "std.parseInt"; path = "${goJsonnetBench}/parseInt.jsonnet";}}
184 ${mkBench {name = "std.reverse"; path = "${goJsonnetBench}/reverse.jsonnet"; skipScala = "std.reverse is not implemented";}}184 ${mkBench {name = "std.reverse"; path = "${goJsonnetBench}/reverse.jsonnet"; skipScala = "std.reverse is not implemented";}}
185 ${mkBench {name = "std.substr"; path = "${goJsonnetBench}/substr.jsonnet";}}185 ${mkBench {name = "std.substr"; path = "${goJsonnetBench}/substr.jsonnet";}}
186 ${mkBench {name = "Comparsion for array"; path = "${goJsonnetBench}/comparison.jsonnet"; skipScala = "array comparsion is not implemented"; skipCpp = skipSlow;}}186 ${mkBench {name = "Comparsion for array"; path = "${goJsonnetBench}/comparison.jsonnet"; skipScala = "array comparsion is not implemented"; skipCpp = skipSlow;}}
187 ${mkBench {name = "Comparsion for primitives"; path = "${goJsonnetBench}/comparison2.jsonnet"; skipCpp = "can't run: uses up to 192GB of RAM";}}187 ${mkBench {name = "Comparsion for primitives"; path = "${goJsonnetBench}/comparison2.jsonnet"; skipCpp = "can't run: uses up to 192GB of RAM";}}
188 '';188 '';
189}189}
190190