difftreelog
doc: rerun benchmarks (#157)
in: master
* ci: update sjsonnet for benchmark * doc: scratch benchmarks results * feat: another Rust jsonnet implementation appears! Ref: https://github.com/google/jsonnet/pull/1156 * chore: use jdk21-headless for sjsonnet * chore: fix go-jsonnet benchmarking * chore: increase default max-stack for rsjsonnet * chore: update sjsonnet to v0.4.10 * chore: update skipped benchmarks list * chore: rerun benchmarks
8 files changed
README.adocdiffbeforeafterboth69* https://github.com/google/jsonnet[C++];69* https://github.com/google/jsonnet[C++];70* https://github.com/google/go-jsonnet/[Go];70* https://github.com/google/go-jsonnet/[Go];71* https://github.com/databricks/sjsonnet[Scala].71* https://github.com/databricks/sjsonnet[Scala].72* [NEW] https://github.com/eduardosm/rsjsonnet[Another Rust impl appears].727373This implementation shows performance better than all existing implementations.74This implementation shows performance better than all existing implementations.74For more information see link:./docs/benchmarks.md[benchmarks]75For more information see link:./docs/benchmarks.md[benchmarks]docs/benchmarks.mddiffbeforeafterboth9<details>9<details>10<summary>Tested versions</summary>10<summary>Tested versions</summary>111112Go: Jsonnet commandline interpreter (Go implementation) v0.19.112Go: Jsonnet commandline interpreter (Go implementation) v0.20.0131314```14```15Jsonnet commandline interpreter (Go implementation) v0.19.115Jsonnet commandline interpreter (Go implementation) v0.20.0161617jsonnet {<option>} <filename>17jsonnet {<option>} <filename>181868 advised to use -- if the argument is unknown, e.g. jsonnet -- "$FILENAME".68 advised to use -- if the argument is unknown, e.g. jsonnet -- "$FILENAME".69```69```707071C++: Jsonnet commandline interpreter v0.19.171C++: Jsonnet commandline interpreter v0.20.0727273```73```74Jsonnet commandline interpreter v0.19.174Jsonnet commandline interpreter v0.20.0757576jsonnet {<option>} <filename>76jsonnet {<option>} <filename>7777121121122```122```123Missing argument: file <str>123Missing argument: file <str>124Expected Signature: Sjsonnet 0.4.3124Expected Signature: Sjsonnet 0.4.10125usage: sjsonnet [sjsonnet-options] script-file125usage: sjsonnet [sjsonnet-options] script-file126 -i --interactive Run Mill in interactive mode, suitable for opening REPLs and taking user126 -i --interactive Run Mill in interactive mode, suitable for opening REPLs and127 input127 taking user input128 -J --jpath <str> Specify an additional library search dir (right-most wins)128 -J --jpath <str> Specify an additional library search dir (right-most wins)129 -o --output-file <str> Write to the output file rather than stdout129 -o --output-file <str> Write to the output file rather than stdout130 -m --multi <str> Write multiple files to the directory, list files on stdout130 -m --multi <str> Write multiple files to the directory, list files on stdout131 -c --create-output-dirs Automatically creates all parent directories for files131 -c --create-output-dirs Automatically creates all parent directories for files132 -y --yaml-stream Write output as a YAML stream of JSON documents132 -y --yaml-stream Write output as a YAML stream of JSON documents133 -S --string Expect a string, manifest as plain text133 -S --string Expect a string, manifest as plain text134 -V --ext-str <str> <var>[=<val>] Provide 'external' variable as string. 'If <val> is134 -V --ext-str <str> <var>[=<val>] Provide 'external' variable as string. 'If135 omitted, get from environment var <var>135 <val> is omitted, get from environment var <var>136 --ext-str-file <str> <var>=<file> Provide 'external' variable as string from the file136 --ext-str-file <str> <var>=<file> Provide 'external' variable as string from the137 -V --ext-code <str> <var>[=<code>] Provide 'external' variable as Jsonnet code. If <code> is137 file138 omitted, get from environment var <var>138 -V --ext-code <str> <var>[=<code>] Provide 'external' variable as Jsonnet code.139 --ext-code-file <str> <var>=<file> Provide 'external' variable as Jsonnet code from the file139 If <code> is omitted, get from environment var <var>140 -A --tla-str <str> <var>[=<val>] Provide top-level arguments as string. 'If <val> is140 --ext-code-file <str> <var>=<file> Provide 'external' variable as Jsonnet code141 omitted, get from environment var <var>141 from the file142 --tla-str-file <str> <var>=<file> Provide top-level arguments variable as string from the file142 -A --tla-str <str> <var>[=<val>] Provide top-level arguments as string. 'If143 -V --tla-code <str> <var>[=<val>] Provide top-level arguments as Jsonnet code. 'If <val> is143 <val> is omitted, get from environment var <var>144 omitted, get from environment var <var>144 --tla-str-file <str> <var>=<file> Provide top-level arguments variable as string145 --tla-code-file <str> <var>=<file> Provide top-level arguments variable as Jsonnet code from145 from the file146 the file146 -V --tla-code <str> <var>[=<val>] Provide top-level arguments as Jsonnet code.147 -n --indent <int> How much to indent your output JSON147 'If <val> is omitted, get from environment var <var>148 -p --preserve-order Preserves order of keys in the resulting JSON148 --tla-code-file <str> <var>=<file> Provide top-level arguments variable as Jsonnet149 --strict Enforce some additional syntax limitations149 code from the file150 --yaml-out Write output as a YAML document150 -n --indent <int> How much to indent your output JSON151 file <str> The jsonnet file you wish to evaluate151 -p --preserve-order Preserves order of keys in the resulting JSON152 --yaml-debug Generate source line comments in the output YAML doc to make it easier to152 --strict Enforce some additional syntax limitations153 figure out where values come from.153 --yaml-out Write output as a YAML document154 --no-static-errors Turn static errors into warnings154 file <str> The jsonnet file you wish to evaluate155 --fatal-warnings Fail if any warnings were emitted155 --yaml-debug Generate source line comments in the output YAML doc to make156 it easier to figure out where values come from.157 --no-static-errors Turn static errors into warnings158 --fatal-warnings Fail if any warnings were emitted159 -e --exec Evaluate the given string as Jsonnet rather than treating it160 as a file name161 --no-duplicate-keys-in-comprehension Raise an error if an object comprehension contains duplicate162 keys163 --strict-import-syntax Raise an error if import expressions are used without proper164 parentheses, e.g. import "foo".bar rather than (import165 "foo").bar166 --strict-inherited-assertions Properly handle assertions defined in a Jsonnet dictionary167 that is extended more than once156168157169158```170```159171160</details>172</details>161173174Rust (alternative):162175176```177Usage: rsjsonnet [OPTIONS] <filename>178179Arguments:180 <filename> 181182Options:183 -e, --exec Treat filename as code184 -J, --jpath <dir> Specify an additional library search dir (right-most wins)185 -o, --output-file <file> Write to the output file rather than stdout186 -m, --multi <dir> Write multiple files to the directory, list files on stdout187 -y, --yaml-stream Write output as a YAML stream of JSON documents188 -S, --string Expect a string, manifest as plain text189 -s, --max-stack <n> Number of allowed stack frames190 -t, --max-trace <n> Max length of stack trace before cropping191 -V, --ext-str <var=[val]> 192 --ext-str-file <var=file> 193 --ext-code <var[=code]> 194 --ext-code-file <var=file> 195 -A, --tla-str <var[=val]> 196 --tla-str-file <var=file> 197 --tla-code <var[=code]> 198 --tla-code-file <var=file> 199 -h, --help Print help200201```202203</details>204205163## Real world206## Real world164207165### Graalvm CI208### Graalvm CI238281239| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |282| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |240|:---|---:|---:|---:|---:|283|:---|---:|---:|---:|---:|241| `Rust` | 122.0 ± 1.9 | 118.3 | 125.8 | 1.00 |284| `Rust` | 93.6 ± 0.6 | 92.5 | 94.7 | 1.00 |242| `Go` | 1402.0 ± 31.8 | 1359.7 | 1480.9 | 11.49 ± 0.32 |285| `Rust (alternative, rsjsonnet)` | 263.3 ± 1.8 | 259.0 | 268.4 | 2.81 ± 0.03 |243| `Scala` | 869.3 ± 9.6 | 852.0 | 889.4 | 7.12 ± 0.14 |286| `Go` | 1204.6 ± 5.0 | 1196.0 | 1215.4 | 12.87 ± 0.10 |287| `Scala` | 720.0 ± 2.9 | 713.4 | 725.3 | 7.70 ± 0.06 |244288245### Kube-prometheus manifests289### Kube-prometheus manifests246290291335292| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |336| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |293|:---|---:|---:|---:|---:|337|:---|---:|---:|---:|---:|294| `Rust` | 113.2 ± 2.9 | 109.7 | 120.1 | 1.00 |338| `Rust` | 129.4 ± 1.4 | 127.7 | 132.8 | 1.00 |295| `Go` | 2192.3 ± 25.1 | 2166.1 | 2262.2 | 19.36 ± 0.54 |339| `Rust (alternative, rsjsonnet)` | 197.0 ± 1.9 | 193.6 | 200.7 | 1.52 ± 0.02 |296| `Scala` | 1117.5 ± 21.9 | 1075.8 | 1152.1 | 9.87 ± 0.31 |340| `Go` | 2127.7 ± 13.8 | 2105.4 | 2151.5 | 16.44 ± 0.21 |341| `Scala` | 947.9 ± 11.1 | 926.1 | 967.9 | 7.33 ± 0.12 |297| `C++` | 88573.2 ± 4833.2 | 84345.6 | 97409.2 | 782.15 ± 47.02 |342| `C++` | 87633.8 ± 569.9 | 86464.2 | 89118.8 | 677.29 ± 8.72 |298343299## Benchmarks from C++ jsonnet (/perf_tests)344## Benchmarks from C++ jsonnet (/perf_tests)300345313358314| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |359| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |315|:---|---:|---:|---:|---:|360|:---|---:|---:|---:|---:|316| `Rust` | 7.4 ± 0.2 | 6.9 | 8.9 | 1.00 |361| `Rust` | 5.6 ± 0.1 | 5.4 | 6.2 | 1.00 |317| `Go` | 117.4 ± 5.1 | 112.1 | 139.2 | 15.87 ± 0.85 |362| `Rust (alternative, rsjsonnet)` | 45.3 ± 0.9 | 43.5 | 47.8 | 8.04 ± 0.25 |363| `Go` | 98.2 ± 1.6 | 95.0 | 100.8 | 17.45 ± 0.50 |318| `Scala` | 373.1 ± 4.5 | 367.8 | 383.0 | 50.45 ± 1.70 |364| `Scala` | 331.1 ± 5.8 | 322.3 | 343.7 | 58.79 ± 1.73 |319| `C++` | 85.9 ± 2.1 | 82.1 | 90.1 | 11.62 ± 0.46 |365| `C++` | 76.5 ± 0.7 | 75.4 | 78.0 | 13.59 ± 0.34 |320366321### Large string template367### Large string template322368323> Note: No results for Go, fails with os stack size exhausion369> Note: No results for Go, fails with os stack size exhausion324370325| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |371| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |326|:---|---:|---:|---:|---:|372|:---|---:|---:|---:|---:|327| `Rust` | 8.2 ± 0.3 | 7.3 | 9.4 | 1.00 |373| `Rust` | 6.7 ± 0.1 | 6.4 | 7.1 | 1.00 |328| `Scala` | 423.8 ± 5.5 | 416.2 | 437.5 | 51.62 ± 2.00 |374| `Rust (alternative, rsjsonnet)` | 7.1 ± 0.2 | 6.8 | 7.6 | 1.05 ± 0.03 |375| `Scala` | 392.7 ± 2.7 | 388.2 | 399.8 | 58.29 ± 1.19 |329| `C++` | 15292.1 ± 204.0 | 15070.1 | 15840.7 | 1862.69 ± 72.39 |376| `C++` | 14376.2 ± 35.8 | 14317.5 | 14448.6 | 2133.86 ± 41.53 |330377331### Realistic 1378### Realistic 1332379585632586| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |633| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |587|:---|---:|---:|---:|---:|634|:---|---:|---:|---:|---:|588| `Rust` | 14.6 ± 0.6 | 13.5 | 17.9 | 1.00 |635| `Rust` | 12.6 ± 0.1 | 12.3 | 12.9 | 1.00 |589| `Go` | 7663.9 ± 114.5 | 7518.9 | 7912.3 | 524.74 ± 24.02 |636| `Rust (alternative, rsjsonnet)` | 49.7 ± 1.0 | 47.3 | 53.0 | 3.96 ± 0.09 |590| `Scala` | 414.1 ± 5.4 | 406.8 | 429.4 | 28.35 ± 1.28 |637| `Go` | 6858.1 ± 34.9 | 6815.9 | 6951.8 | 546.32 ± 6.87 |638| `Scala` | 382.3 ± 3.9 | 371.7 | 387.1 | 30.46 ± 0.47 |591| `C++` | 26376.7 ± 354.2 | 25755.3 | 26908.5 | 1806.00 ± 81.81 |639| `C++` | 24472.7 ± 155.7 | 24230.3 | 24799.3 | 1949.51 ± 25.63 |592640593### Realistic 2641### Realistic 2594642707755708| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |756| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |709|:---|---:|---:|---:|---:|757|:---|---:|---:|---:|---:|710| `Rust` | 295.6 ± 8.9 | 285.1 | 319.9 | 1.00 |758| `Rust` | 259.9 ± 4.4 | 250.9 | 266.7 | 1.00 |759| `Rust (alternative, rsjsonnet)` | 550.2 ± 16.6 | 531.9 | 600.7 | 2.12 ± 0.07 |711| `Go` | 7540.7 ± 107.5 | 7357.3 | 7792.5 | 25.51 ± 0.85 |760| `Go` | 6732.4 ± 51.4 | 6660.2 | 6858.6 | 25.90 ± 0.48 |712| `Scala` | 781.0 ± 27.4 | 745.3 | 854.7 | 2.64 ± 0.12 |761| `Scala` | 675.4 ± 10.9 | 667.3 | 720.0 | 2.60 ± 0.06 |713| `C++` | 30144.1 ± 574.5 | 28895.0 | 30967.3 | 101.99 ± 3.62 |762| `C++` | 26414.5 ± 259.9 | 25948.9 | 26934.4 | 101.63 ± 1.99 |714763715## Benchmarks from C++ jsonnet (/benchmarks)764## Benchmarks from C++ jsonnet (/benchmarks)716765748797749| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |798| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |750|:---|---:|---:|---:|---:|799|:---|---:|---:|---:|---:|751| `Rust` | 2.2 ± 0.1 | 1.9 | 3.6 | 1.00 |800| `Rust` | 1.8 ± 0.1 | 1.6 | 2.6 | 1.00 |752| `Go` | 6.7 ± 0.6 | 6.0 | 17.0 | 3.10 ± 0.32 |801| `Rust (alternative, rsjsonnet)` | 3.1 ± 0.1 | 2.8 | 3.4 | 1.69 ± 0.12 |802| `Go` | 5.3 ± 0.2 | 4.9 | 5.9 | 2.90 ± 0.20 |753| `Scala` | 306.5 ± 2.1 | 302.8 | 311.8 | 141.78 ± 7.81 |803| `Scala` | 287.4 ± 1.2 | 285.4 | 288.9 | 156.55 ± 9.92 |754| `C++` | 34.7 ± 2.2 | 32.6 | 52.1 | 16.04 ± 1.35 |804| `C++` | 32.1 ± 0.3 | 31.6 | 33.0 | 17.49 ± 1.12 |755805756### Inheritance recursion806### Inheritance recursion757807788838789| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |839| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |790|:---|---:|---:|---:|---:|840|:---|---:|---:|---:|---:|791| `Rust` | 452.8 ± 20.3 | 425.2 | 494.6 | 1.00 |841| `Rust` | 376.1 ± 5.2 | 364.3 | 383.7 | 1.00 |842| `Rust (alternative, rsjsonnet)` | 496.7 ± 13.0 | 470.6 | 506.8 | 1.32 ± 0.04 |792| `Go` | 1076.4 ± 16.2 | 1049.9 | 1111.1 | 2.38 ± 0.11 |843| `Go` | 873.9 ± 7.1 | 859.3 | 888.0 | 2.32 ± 0.04 |793| `Scala` | 475.5 ± 8.7 | 462.2 | 494.4 | 1.05 ± 0.05 |844| `Scala` | 420.8 ± 6.3 | 413.9 | 437.1 | 1.12 ± 0.02 |794| `C++` | 3029.7 ± 121.1 | 2787.2 | 3214.5 | 6.69 ± 0.40 |845| `C++` | 2647.5 ± 14.2 | 2630.9 | 2675.6 | 7.04 ± 0.10 |795846796### Simple recursive call847### Simple recursive call797848828879829| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |880| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |830|:---|---:|---:|---:|---:|881|:---|---:|---:|---:|---:|831| `Rust` | 109.2 ± 2.4 | 104.8 | 114.3 | 1.00 |882| `Rust` | 81.3 ± 0.3 | 80.9 | 82.4 | 1.00 |832| `Go` | 429.0 ± 8.2 | 419.4 | 454.3 | 3.93 ± 0.12 |883| `Rust (alternative, rsjsonnet)` | 202.3 ± 12.0 | 183.1 | 237.6 | 2.49 ± 0.15 |884| `Go` | 349.4 ± 1.7 | 347.2 | 354.2 | 4.30 ± 0.03 |833| `Scala` | 338.7 ± 3.2 | 334.6 | 345.6 | 3.10 ± 0.07 |885| `Scala` | 322.5 ± 3.0 | 318.7 | 330.7 | 3.97 ± 0.04 |834| `C++` | 210.0 ± 8.0 | 195.5 | 227.5 | 1.92 ± 0.08 |886| `C++` | 193.5 ± 0.9 | 191.4 | 194.8 | 2.38 ± 0.01 |835887836### Foldl string concat888### Foldl string concat837889846898847| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |899| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |848|:---|---:|---:|---:|---:|900|:---|---:|---:|---:|---:|849| `Rust` | 12.5 ± 0.6 | 11.4 | 17.3 | 1.00 |901| `Rust` | 8.9 ± 0.1 | 8.6 | 9.3 | 1.00 |850| `Go` | 64.8 ± 3.1 | 60.8 | 78.8 | 5.16 ± 0.36 |902| `Rust (alternative, rsjsonnet)` | 303.1 ± 3.8 | 297.6 | 308.1 | 34.06 ± 0.68 |903| `Go` | 50.9 ± 0.8 | 48.3 | 52.2 | 5.72 ± 0.13 |851| `Scala` | 630.6 ± 15.6 | 606.3 | 659.8 | 50.25 ± 2.83 |904| `Scala` | 550.6 ± 5.5 | 542.8 | 563.7 | 61.86 ± 1.13 |852| `C++` | 1073.3 ± 18.2 | 1041.0 | 1107.6 | 85.53 ± 4.56 |905| `C++` | 902.6 ± 4.8 | 891.4 | 912.1 | 101.41 ± 1.65 |853906854### Array sorts907### Array sorts855908856> Note: No results for Scala, std.reverse is not implemented909> Note: No results for Scala, sjsonnet doesn't support keyF in std.sort: https://github.com/databricks/sjsonnet/issues/204857910858<details>911<details>859<summary>Source</summary>912<summary>Source</summary>876929877| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |930| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |878|:---|---:|---:|---:|---:|931|:---|---:|---:|---:|---:|879| `Rust` | 4.2 ± 0.1 | 3.9 | 4.9 | 1.00 |932| `Rust` | 3.2 ± 0.2 | 2.9 | 4.1 | 1.00 |880| `Go` | 14.8 ± 0.5 | 13.7 | 17.8 | 3.51 ± 0.17 |933| `Rust (alternative, rsjsonnet)` | 14.4 ± 0.6 | 13.1 | 16.2 | 4.46 ± 0.28 |934| `Go` | 12.1 ± 0.2 | 11.4 | 12.8 | 3.74 ± 0.20 |881| `C++` | 3964.0 ± 187.1 | 3700.2 | 4225.1 | 939.25 ± 55.45 |935| `C++` | 3637.1 ± 24.9 | 3557.4 | 3664.7 | 1128.64 ± 56.81 |882936883### Lazy array937### Lazy array884938898952899| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |953| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |900|:---|---:|---:|---:|---:|954|:---|---:|---:|---:|---:|901| `Rust` | 58.8 ± 2.0 | 55.6 | 64.2 | 1.00 |955| `Rust` | 54.1 ± 1.1 | 52.3 | 56.3 | 1.30 ± 0.03 |956| `Rust (alternative, rsjsonnet)` | 41.7 ± 0.7 | 39.6 | 43.8 | 1.00 |902| `Go` | 661.6 ± 26.6 | 629.6 | 730.1 | 11.25 ± 0.59 |957| `Go` | 596.5 ± 5.2 | 585.1 | 606.9 | 14.30 ± 0.29 |903| `Scala` | 348.8 ± 6.6 | 339.7 | 365.3 | 5.93 ± 0.23 |958| `Scala` | 306.6 ± 1.6 | 303.5 | 310.4 | 7.35 ± 0.14 |904| `C++` | 206.4 ± 3.3 | 202.5 | 215.2 | 3.51 ± 0.13 |959| `C++` | 184.5 ± 1.8 | 182.0 | 187.9 | 4.42 ± 0.09 |905960906### Inheritance function recursion961### Inheritance function recursion907962926981927| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |982| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |928|:---|---:|---:|---:|---:|983|:---|---:|---:|---:|---:|929| `Rust` | 1.9 ± 0.1 | 1.6 | 3.3 | 1.00 |984| `Rust` | 1.6 ± 0.1 | 1.5 | 2.5 | 1.00 |930| `Go` | 3.0 ± 0.2 | 2.7 | 5.1 | 1.58 ± 0.15 |985| `Rust (alternative, rsjsonnet)` | 2.9 ± 0.1 | 2.7 | 3.7 | 1.78 ± 0.13 |986| `Go` | 2.4 ± 0.1 | 2.1 | 2.9 | 1.48 ± 0.12 |931| `Scala` | 310.0 ± 9.5 | 299.9 | 341.1 | 161.51 ± 9.88 |987| `Scala` | 293.2 ± 1.5 | 289.9 | 296.1 | 178.20 ± 12.35 |932| `C++` | 1505.6 ± 74.0 | 1363.5 | 1640.8 | 784.26 ± 56.71 |988| `C++` | 999.1 ± 9.2 | 974.4 | 1010.9 | 607.23 ± 42.34 |933989934### String strips990### String strips9359919511007952| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1008| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |953|:---|---:|---:|---:|---:|1009|:---|---:|---:|---:|---:|954| `Rust` | 9.4 ± 0.3 | 8.7 | 10.4 | 1.00 |1010| `Rust` | 8.6 ± 0.2 | 8.4 | 9.5 | 1.00 |955| `Go` | 15.0 ± 0.5 | 13.9 | 17.6 | 1.60 ± 0.08 |1011| `Rust (alternative, rsjsonnet)` | 18.4 ± 0.4 | 17.6 | 20.8 | 2.13 ± 0.06 |1012| `Go` | 11.2 ± 0.2 | 10.4 | 11.9 | 1.29 ± 0.04 |956| `Scala` | 340.6 ± 5.4 | 333.3 | 359.9 | 36.39 ± 1.36 |1013| `Scala` | 294.9 ± 2.0 | 292.2 | 301.9 | 34.10 ± 0.65 |957| `C++` | 37161.7 ± 525.9 | 36471.3 | 38275.4 | 3970.49 ± 145.97 |1014| `C++` | 37345.3 ± 208.2 | 36567.2 | 37689.0 | 4318.10 ± 80.13 |9581015959### Big object1016### Big object96010179871044988| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1045| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |989|:---|---:|---:|---:|---:|1046|:---|---:|---:|---:|---:|990| `Rust` | 2.5 ± 0.1 | 2.3 | 3.3 | 1.00 |1047| `Rust` | 2.2 ± 0.1 | 1.9 | 3.0 | 1.00 |991| `Go` | 5.2 ± 0.3 | 4.6 | 7.0 | 2.07 ± 0.15 |1048| `Rust (alternative, rsjsonnet)` | 3.2 ± 0.1 | 2.9 | 3.5 | 1.46 ± 0.10 |1049| `Go` | 4.1 ± 0.1 | 3.7 | 4.6 | 1.85 ± 0.13 |992| `Scala` | 302.6 ± 6.4 | 290.3 | 312.9 | 120.34 ± 6.71 |1050| `Scala` | 292.3 ± 2.9 | 289.3 | 304.0 | 132.11 ± 8.64 |993| `C++` | 29.4 ± 1.4 | 27.7 | 38.5 | 11.71 ± 0.82 |1051| `C++` | 28.3 ± 0.3 | 27.7 | 29.1 | 12.80 ± 0.84 |9941052995## Benchmarks from Go jsonnet (builtins)1053## Benchmarks from Go jsonnet (builtins)9961054101010681011| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1069| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1012|:---|---:|---:|---:|---:|1070|:---|---:|---:|---:|---:|1013| `Rust` | 3.4 ± 0.1 | 3.1 | 4.9 | 1.00 |1071| `Rust` | 2.7 ± 0.1 | 2.4 | 3.4 | 1.00 |1072| `Rust (alternative, rsjsonnet)` | 2195.9 ± 48.5 | 2098.1 | 2229.6 | 804.07 ± 39.58 |1014| `Go` | 21.6 ± 0.8 | 19.7 | 27.1 | 6.32 ± 0.34 |1073| `Go` | 17.0 ± 0.3 | 16.1 | 17.7 | 6.22 ± 0.29 |1015| `Scala` | 355.0 ± 6.0 | 340.7 | 367.4 | 103.77 ± 4.62 |1074| `Scala` | 313.8 ± 1.2 | 311.3 | 316.1 | 114.91 ± 5.07 |1016| `C++` | 16359.4 ± 663.5 | 15526.0 | 17805.8 | 4782.25 ± 276.36 |1075| `C++` | 14621.6 ± 110.0 | 14473.9 | 14774.9 | 5354.05 ± 238.94 |101710761018### std.base64Decode1077### std.base64Decode10191078103110901032| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1091| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1033|:---|---:|---:|---:|---:|1092|:---|---:|---:|---:|---:|1034| `Rust` | 3.4 ± 0.2 | 3.1 | 5.3 | 1.00 |1093| `Rust` | 2.6 ± 0.1 | 2.3 | 3.1 | 1.00 |1094| `Rust (alternative, rsjsonnet)` | 7889.2 ± 74.7 | 7711.6 | 8051.1 | 3045.22 ± 138.95 |1035| `Go` | 21.0 ± 1.5 | 19.6 | 32.2 | 6.24 ± 0.52 |1095| `Go` | 15.2 ± 0.3 | 14.6 | 16.5 | 5.85 ± 0.28 |1036| `Scala` | 358.3 ± 7.1 | 349.0 | 379.9 | 106.23 ± 5.27 |1096| `Scala` | 313.0 ± 2.5 | 309.5 | 321.2 | 120.80 ± 5.47 |1037| `C++` | 10921.3 ± 240.4 | 10653.9 | 11346.7 | 3237.97 ± 163.58 |1097| `C++` | 9930.9 ± 26.5 | 9895.0 | 9997.9 | 3833.33 ± 171.41 |103810981039### std.base64DecodeBytes1099### std.base64DecodeBytes10401100105211121053| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1113| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1054|:---|---:|---:|---:|---:|1114|:---|---:|---:|---:|---:|1055| `Rust` | 45.7 ± 1.4 | 43.6 | 52.1 | 1.00 |1115| `Rust` | 34.8 ± 0.5 | 33.4 | 36.0 | 1.00 |1056| `Go` | 303.6 ± 8.4 | 292.1 | 324.7 | 6.64 ± 0.27 |1116| `Rust (alternative, rsjsonnet)` | 8116.2 ± 37.2 | 8049.1 | 8176.2 | 233.52 ± 3.24 |1117| `Go` | 271.1 ± 2.3 | 267.1 | 275.7 | 7.80 ± 0.12 |1057| `Scala` | 406.3 ± 8.3 | 397.0 | 424.8 | 8.88 ± 0.32 |1118| `Scala` | 357.2 ± 2.3 | 353.5 | 363.4 | 10.28 ± 0.15 |1058| `C++` | 10058.3 ± 337.9 | 9738.8 | 10641.5 | 219.86 ± 9.92 |1119| `C++` | 9653.7 ± 22.5 | 9621.4 | 9694.3 | 277.75 ± 3.69 |105911201060### std.base64 (byte array)1121### std.base64 (byte array)10611122107311341074| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1135| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1075|:---|---:|---:|---:|---:|1136|:---|---:|---:|---:|---:|1076| `Rust` | 37.0 ± 1.8 | 33.7 | 42.5 | 1.00 |1137| `Rust` | 30.3 ± 0.4 | 29.1 | 31.6 | 1.00 |1077| `Go` | 195.8 ± 11.5 | 180.9 | 219.5 | 5.28 ± 0.41 |1138| `Rust (alternative, rsjsonnet)` | 1460.8 ± 47.6 | 1375.2 | 1568.3 | 48.26 ± 1.72 |1139| `Go` | 156.5 ± 1.9 | 152.5 | 159.4 | 5.17 ± 0.10 |1078| `Scala` | 419.2 ± 13.0 | 396.5 | 454.6 | 11.32 ± 0.66 |1140| `Scala` | 355.9 ± 2.9 | 351.4 | 365.6 | 11.76 ± 0.20 |1079| `C++` | 15605.3 ± 310.2 | 15173.1 | 16065.6 | 421.22 ± 22.47 |1141| `C++` | 13362.4 ± 88.3 | 13028.4 | 13473.8 | 441.41 ± 7.01 |108011421081### std.foldl1143### std.foldl10821144109311551094| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1156| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1095|:---|---:|---:|---:|---:|1157|:---|---:|---:|---:|---:|1096| `Rust` | 7.7 ± 0.7 | 6.8 | 18.5 | 1.00 |1158| `Rust` | 5.3 ± 0.2 | 5.0 | 6.2 | 1.00 |1097| `Go` | 32.6 ± 1.1 | 30.6 | 37.8 | 4.26 ± 0.41 |1159| `Rust (alternative, rsjsonnet)` | 81.5 ± 1.6 | 78.9 | 83.8 | 15.38 ± 0.55 |1098| `Scala` | 461.7 ± 8.5 | 445.0 | 484.5 | 60.35 ± 5.54 |1160| `Go` | 26.6 ± 0.5 | 25.0 | 27.5 | 5.02 ± 0.18 |1099| `C++` | 320.3 ± 6.0 | 308.6 | 335.0 | 41.87 ± 3.85 |1161| `Scala` | 405.4 ± 3.0 | 400.9 | 413.6 | 76.52 ± 2.34 |1162| `C++` | 265.3 ± 2.7 | 260.6 | 271.5 | 50.08 ± 1.57 |110011631101### std.manifestJsonEx1164### std.manifestJsonEx11021165115612191157| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1220| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1158|:---|---:|---:|---:|---:|1221|:---|---:|---:|---:|---:|1159| `Rust` | 1.9 ± 0.1 | 1.7 | 3.0 | 1.00 |1222| `Rust` | 1.7 ± 0.1 | 1.4 | 2.7 | 1.00 |1160| `Go` | 4.2 ± 0.3 | 3.6 | 8.0 | 2.14 ± 0.18 |1223| `Rust (alternative, rsjsonnet)` | 2.9 ± 0.1 | 2.7 | 3.3 | 1.73 ± 0.13 |1224| `Go` | 3.2 ± 0.1 | 2.7 | 3.8 | 1.92 ± 0.15 |1161| `Scala` | 338.9 ± 3.4 | 334.9 | 348.8 | 174.49 ± 8.63 |1225| `Scala` | 294.7 ± 1.7 | 291.6 | 299.0 | 175.84 ± 12.30 |1162| `C++` | 106.6 ± 3.2 | 102.8 | 113.2 | 54.90 ± 3.12 |1226| `C++` | 101.4 ± 0.8 | 99.3 | 102.9 | 60.48 ± 4.24 |116312271164### std.manifestTomlEx1228### std.manifestTomlEx116512291166> Note: No results for Scala, std.manifestTomlEx is not implemented1230> Note: No results for Scala, std.manifestTomlEx is not implemented: https://github.com/databricks/sjsonnet/issues/111116712311168<details>1232<details>1169<summary>Source</summary>1233<summary>Source</summary>122212861223| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1287| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1224|:---|---:|---:|---:|---:|1288|:---|---:|---:|---:|---:|1225| `Rust` | 1.9 ± 0.1 | 1.8 | 2.7 | 1.00 |1289| `Rust` | 1.7 ± 0.1 | 1.4 | 2.7 | 1.00 |1226| `Go` | 4.2 ± 0.3 | 3.7 | 8.0 | 2.17 ± 0.19 |1290| `Rust (alternative, rsjsonnet)` | 7.8 ± 0.2 | 7.3 | 8.5 | 4.65 ± 0.36 |1291| `Go` | 3.2 ± 0.1 | 2.9 | 3.7 | 1.90 ± 0.16 |1227| `C++` | 1131.6 ± 28.1 | 1089.2 | 1198.7 | 584.01 ± 30.62 |1292| `C++` | 1046.1 ± 4.9 | 1039.7 | 1053.9 | 622.36 ± 44.25 |122812931229### std.parseInt1294### std.parseInt12301295124213071243| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1308| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1244|:---|---:|---:|---:|---:|1309|:---|---:|---:|---:|---:|1245| `Rust` | 2.0 ± 0.1 | 1.7 | 3.2 | 1.00 |1310| `Rust` | 1.7 ± 0.1 | 1.4 | 2.6 | 1.00 |1246| `Go` | 3.7 ± 0.4 | 3.1 | 9.0 | 1.85 ± 0.21 |1311| `Rust (alternative, rsjsonnet)` | 2.9 ± 0.1 | 2.6 | 3.4 | 1.71 ± 0.16 |1312| `Go` | 2.8 ± 0.1 | 2.4 | 3.3 | 1.64 ± 0.16 |1247| `Scala` | 332.3 ± 7.2 | 326.1 | 359.7 | 168.32 ± 10.37 |1313| `Scala` | 292.7 ± 1.7 | 289.2 | 295.8 | 170.68 ± 14.76 |1248| `C++` | 110.2 ± 1.9 | 106.9 | 115.1 | 55.82 ± 3.36 |1314| `C++` | 101.0 ± 0.7 | 99.0 | 102.0 | 58.88 ± 5.10 |124913151250### std.reverse1316### std.reverse12511252> Note: No results for Scala, std.reverse is not implemented125313171254<details>1318<details>1255<summary>Source</summary>1319<summary>Source</summary>126513291266| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1330| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1267|:---|---:|---:|---:|---:|1331|:---|---:|---:|---:|---:|1268| `Rust` | 59.7 ± 1.9 | 56.3 | 64.7 | 1.00 |1332| `Rust` | 45.3 ± 0.5 | 44.0 | 46.5 | 1.00 |1269| `Go` | 363.6 ± 9.0 | 352.8 | 385.1 | 6.09 ± 0.25 |1333| `Rust (alternative, rsjsonnet)` | 784.1 ± 20.4 | 741.5 | 802.0 | 17.31 ± 0.49 |1334| `Go` | 327.4 ± 2.1 | 323.8 | 331.4 | 7.23 ± 0.10 |1335| `Scala` | 367.0 ± 2.4 | 361.1 | 370.2 | 8.10 ± 0.11 |1270| `C++` | 865.9 ± 16.1 | 839.9 | 902.0 | 14.51 ± 0.54 |1336| `C++` | 659.3 ± 5.4 | 644.6 | 666.0 | 14.55 ± 0.21 |127113371272### std.substr1338### std.substr12731339128513511286| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1352| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1287|:---|---:|---:|---:|---:|1353|:---|---:|---:|---:|---:|1288| `Rust` | 2.6 ± 0.1 | 2.3 | 3.5 | 1.00 |1354| `Rust` | 2.2 ± 0.2 | 1.9 | 3.2 | 1.00 |1289| `Go` | 8.9 ± 0.6 | 8.0 | 15.3 | 3.46 ± 0.29 |1355| `Rust (alternative, rsjsonnet)` | 3.2 ± 0.1 | 3.1 | 3.6 | 1.49 ± 0.11 |1356| `Go` | 6.8 ± 0.2 | 6.3 | 7.4 | 3.12 ± 0.24 |1290| `Scala` | 346.6 ± 9.4 | 337.8 | 375.9 | 134.32 ± 7.51 |1357| `Scala` | 303.6 ± 3.6 | 300.5 | 318.2 | 139.43 ± 9.76 |1291| `C++` | 31.4 ± 1.0 | 29.7 | 36.4 | 12.17 ± 0.72 |1358| `C++` | 29.1 ± 0.4 | 28.3 | 30.2 | 13.36 ± 0.94 |129213591293### Comparsion for array1360### Comparsion for array12941361130613731307| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1374| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1308|:---|---:|---:|---:|---:|1375|:---|---:|---:|---:|---:|1309| `Rust` | 26.0 ± 0.6 | 25.4 | 30.2 | 1.00 |1376| `Rust` | 25.7 ± 0.2 | 25.0 | 26.0 | 1.00 |1310| `Go` | 121.5 ± 6.5 | 116.2 | 141.0 | 4.68 ± 0.28 |1377| `Rust (alternative, rsjsonnet)` | 228.1 ± 7.9 | 214.0 | 245.1 | 8.89 ± 0.31 |1378| `Go` | 150.4 ± 10.4 | 135.9 | 169.4 | 5.86 ± 0.41 |1311| `C++` | 147098.5 ± 3334.1 | 135178.4 | 150470.0 | 5663.91 ± 187.03 |1379| `C++` | 125755.8 ± 989.6 | 123095.8 | 127475.4 | 4901.85 ± 49.12 |131213801313### Comparsion for primitives1381### Comparsion for primitives13141382132513931326| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1394| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |1327|:---|---:|---:|---:|---:|1395|:---|---:|---:|---:|---:|1328| `Rust` | 284.7 ± 10.4 | 267.1 | 315.4 | 1.00 |1396| `Rust` | 385.9 ± 4.2 | 372.4 | 391.5 | 1.00 |1397| `Rust (alternative, rsjsonnet)` | 1287.4 ± 27.0 | 1244.2 | 1335.1 | 3.34 ± 0.08 |1329| `Go` | 2009.5 ± 46.0 | 1931.3 | 2108.9 | 7.06 ± 0.31 |1398| `Go` | 1817.1 ± 18.6 | 1779.7 | 1842.9 | 4.71 ± 0.07 |1330| `Scala` | 550.0 ± 14.8 | 526.3 | 575.4 | 1.93 ± 0.09 |1399| `Scala` | 453.1 ± 3.9 | 448.1 | 462.2 | 1.17 ± 0.02 |13311400flake.nixdiffbeforeafterboth39 jsonnet = pkgs.callPackage ./nix/jsonnet.nix {};39 jsonnet = pkgs.callPackage ./nix/jsonnet.nix {};40 # I didn't managed to build it, and nixpkgs version is marked as broken40 # I didn't managed to build it, and nixpkgs version is marked as broken41 # haskell-jsonnet = pkgs.callPackage ./nix/haskell-jsonnet.nix { };41 # haskell-jsonnet = pkgs.callPackage ./nix/haskell-jsonnet.nix { };42 rsjsonnet = pkgs.callPackage ./nix/rsjsonnet.nix {};424343 jrsonnet = pkgs.callPackage ./nix/jrsonnet.nix {44 jrsonnet = pkgs.callPackage ./nix/jrsonnet.nix {44 inherit craneLib;45 inherit craneLib;60 };61 };616262 benchmarks = pkgs.callPackage ./nix/benchmarks.nix {63 benchmarks = pkgs.callPackage ./nix/benchmarks.nix {63 inherit go-jsonnet sjsonnet jsonnet;64 inherit go-jsonnet sjsonnet jsonnet rsjsonnet;64 jrsonnetVariants = [65 jrsonnetVariants = [65 {66 {66 drv = jrsonnet.overrideAttrs {forBenchmarks = true;};67 drv = jrsonnet.override {forBenchmarks = true;};67 name = "";68 name = "";68 }69 }69 ];70 ];70 };71 };71 benchmarks-quick = pkgs.callPackage ./nix/benchmarks.nix {72 benchmarks-quick = pkgs.callPackage ./nix/benchmarks.nix {72 inherit go-jsonnet sjsonnet jsonnet;73 inherit go-jsonnet sjsonnet jsonnet rsjsonnet;73 quick = true;74 quick = true;74 jrsonnetVariants = [75 jrsonnetVariants = [75 {76 {76 drv = jrsonnet.overrideAttrs {forBenchmarks = true;};77 drv = jrsonnet.override {forBenchmarks = true;};77 name = "";78 name = "";78 }79 }79 ];80 ];80 };81 };81 benchmarks-against-release = pkgs.callPackage ./nix/benchmarks.nix {82 benchmarks-against-release = pkgs.callPackage ./nix/benchmarks.nix {82 inherit go-jsonnet sjsonnet jsonnet;83 inherit go-jsonnet sjsonnet jsonnet rsjsonnet;83 jrsonnetVariants = [84 jrsonnetVariants = [84 {85 {85 drv = jrsonnet.overrideAttrs {forBenchmarks = true;};86 drv = jrsonnet.override {forBenchmarks = true;};86 name = "current";87 name = "current";87 }88 }88 {89 {89 drv = jrsonnet-nightly.overrideAttrs {forBenchmarks = true;};90 drv = jrsonnet-nightly.override {forBenchmarks = true;};90 name = "current-nightly";91 name = "current-nightly";91 }92 }92 {93 {93 drv = jrsonnet-release.overrideAttrs {forBenchmarks = true;};94 drv = jrsonnet-release.override {forBenchmarks = true;};94 name = "release";95 name = "release";95 }96 }96 ];97 ];97 };98 };98 benchmarks-quick-against-release = pkgs.callPackage ./nix/benchmarks.nix {99 benchmarks-quick-against-release = pkgs.callPackage ./nix/benchmarks.nix {99 inherit go-jsonnet sjsonnet jsonnet;100 inherit go-jsonnet sjsonnet jsonnet rsjsonnet;100 quick = true;101 quick = true;101 jrsonnetVariants = [102 jrsonnetVariants = [102 {103 {103 drv = jrsonnet;104 drv = jrsonnet.override {forBenchmarks = true;};104 name = "current";105 name = "current";105 }106 }106 {107 {107 drv = jrsonnet-nightly;108 drv = jrsonnet-nightly.override {forBenchmarks = true;};108 name = "current-nightly";109 name = "current-nightly";109 }110 }110 {111 {111 drv = jrsonnet-release;112 drv = jrsonnet-release.override {forBenchmarks = true;};112 name = "release";113 name = "release";113 }114 }114 ];115 ];nix/benchmarks.nixdiffbeforeafterboth8, sjsonnet8 go-jsonnet,9, jsonnet9 sjsonnet,10, hyperfine10 jsonnet,11 rsjsonnet,11, quick ? false12 hyperfine,12, jrsonnetVariants13 quick ? false,14 jrsonnetVariants,13}:15}:1415with lib;16with lib; let48 outputHashMode = "recursive";48 outputHashMode = "recursive";49 buildInputs = [ cacert ];49 buildInputs = [cacert];50 }50 }51 ''51 ''52 mkdir -p $out52 mkdir -p $out53 cp -r ${src}/* $out/53 cp -r ${src}/* $out/54 cd $out54 cd $out55 mkdir vendor55 mkdir vendor56 ${jsonnet-bundler}/bin/jb install56 ${jsonnet-bundler}/bin/jb install57 '';57 '';585859 # Removes outsiders from the output59 # Removes outsiders from the output60 # Useful when comparing performance of different jrsonnet releases60 # Useful when comparing performance of different jrsonnet releases66 unpackPhase = "true";69 unpackPhase = "true";677068 buildInputs = [71 buildInputs = [69 go-jsonnet70 sjsonnet72 sjsonnet71 jsonnet73 jsonnet74 rsjsonnet75 go-jsonnet727673 hyperfine77 hyperfine74 ];78 ];757976 installPhase =80 installPhase = let77 let78 mkBench = { name, path, omitSource ? false, pathIsGenerator ? false, skipScala ? "", skipCpp ? "", skipGo ? "", vendor ? "" }: ''81 mkBench = {82 name,83 path,84 omitSource ? false,85 pathIsGenerator ? false,86 skipRustAlternative ? "",87 skipScala ? "",88 skipCpp ? "",89 skipGo ? "",90 vendor ? "",91 }: ''79 set -oux92 echo >> $out8093 echo "### ${name}" >> $out81 echo >> $out94 echo >> $out82 echo "### ${name}" >> $out95 ${optionalString (skipRustAlternative != "") ''96 echo "> Note: No results for Rust (alternative), ${skipRustAlternative}" >> $out83 echo >> $out97 echo >> $out84 ${optionalString (skipGo != "") ''98 ''}99 ${optionalString (skipGo != "") ''85 echo "> Note: No results for Go, ${skipGo}" >> $out100 echo "> Note: No results for Go, ${skipGo}" >> $out86 echo >> $out101 echo >> $out87 ''}102 ''}88 ${optionalString (skipScala != "") ''103 ${optionalString (skipScala != "") ''89 echo "> Note: No results for Scala, ${skipScala}" >> $out104 echo "> Note: No results for Scala, ${skipScala}" >> $out90 echo >> $out105 echo >> $out91 ''}106 ''}92 ${optionalString (skipCpp != "") ''107 ${optionalString (skipCpp != "") ''93 echo "> Note: No results for C++, ${skipCpp}" >> $out108 echo "> Note: No results for C++, ${skipCpp}" >> $out94 echo >> $out109 echo >> $out95 ''}110 ''}96 ${optionalString (!quick && !omitSource) ''111 ${optionalString (!quick && !omitSource) ''97 echo "<details>" >> $out112 echo "<details>" >> $out98 echo "<summary>Source</summary>" >> $out113 echo "<summary>Source</summary>" >> $out99 echo >> $out114 echo >> $out100 echo "\`\`\`jsonnet" >> $out115 echo "\`\`\`jsonnet" >> $out101 ${optionalString pathIsGenerator "echo \"// Generator source\" >> $out"}116 ${optionalString pathIsGenerator "echo \"// Generator source\" >> $out"}102 cat ${path} >> $out117 cat ${path} >> $out103 echo >> $out118 echo >> $out104 echo "\`\`\`" >> $out119 echo "\`\`\`" >> $out105 echo "</details>" >> $out120 echo "</details>" >> $out106 echo >> $out121 echo >> $out107 ''}122 ''}108 path=${path}123 path=${path}109 ${optionalString pathIsGenerator ''124 ${optionalString pathIsGenerator ''110 go-jsonnet $path > generated.jsonnet125 go-jsonnet $path > generated.jsonnet111 path=generated.jsonnet126 path=generated.jsonnet112 ''}127 ''}113 hyperfine -N -w4 -m20 --output=pipe --style=basic --export-markdown result.md \128 hyperfine -N -w4 -m20 --output=pipe --style=basic --export-markdown result.md \114 ${concatStringsSep " " (forEach jrsonnetVariants (variant:129 ${concatStringsSep " " (forEach jrsonnetVariants (115 "\"${variant.drv}/bin/jrsonnet $path ${optionalString (vendor != "") "-J${vendor}"}\" -n \"Rust${if variant.name != "" then " (${variant.name})" else ""}\""130 variant: "\"${variant.drv}/bin/jrsonnet $path${optionalString (vendor != "") " -J${vendor}"}\" -n \"Rust${131 if variant.name != ""132 then " (${variant.name})"133 else ""134 }\""116 ))} \135 ))} \136 ${optionalString (skipRustAlternative == "") "\"rsjsonnet $path${optionalString (vendor != "") " -J ${vendor}"}\" -n \"Rust (alternative, rsjsonnet)\""} \117 ${optionalString (skipGo == "") "\"go-jsonnet $path ${optionalString (vendor != "") "-J ${vendor}"}\" -n \"Go\""} \137 ${optionalString (skipGo == "") "\"go-jsonnet $path${optionalString (vendor != "") " -J ${vendor}"}\" -n \"Go\""} \118 ${optionalString (skipScala == "") "\"sjsonnet $path ${optionalString (vendor != "") "-J ${vendor}"}\" -n \"Scala\""} \138 ${optionalString (skipScala == "") "\"sjsonnet $path${optionalString (vendor != "") " -J ${vendor}"}\" -n \"Scala\""} \119 ${optionalString (skipCpp == "") "\"jsonnet $path ${optionalString (vendor != "") "-J ${vendor}"}\" -n \"C++\""}139 ${optionalString (skipCpp == "") "\"jsonnet $path${optionalString (vendor != "") " -J ${vendor}"}\" -n \"C++\""}120 cat result.md >> $out140 cat result.md >> $out121 '';141 '';122 in142 in ''123 ''143 set -oux144145 temp=$(mktemp -d)146 cd $temp147124 touch $out148 touch $out125 ${optionalString (!quick) ''149 ${optionalString (!quick) ''126 cat ${./benchmarks.md} >> $out150 cat ${./benchmarks.md} >> $out127 echo >> $out151 echo >> $out128152129 echo "<details>" >> $out153 echo "<details>" >> $out130 echo "<summary>Tested versions</summary>" >> $out154 echo "<summary>Tested versions</summary>" >> $out131 echo >> $out155 echo >> $out132 echo Go: $(go-jsonnet --version) >> $out156 echo Go: $(go-jsonnet --version) >> $out133 echo >> $out157 echo >> $out134 echo "\`\`\`" >> $out158 echo "\`\`\`" >> $out135 go-jsonnet --help >> $out159 go-jsonnet --help >> $out136 echo "\`\`\`" >> $out160 echo "\`\`\`" >> $out137 echo >> $out161 echo >> $out138 echo C++: $(jsonnet --version) >> $out162 echo C++: $(jsonnet --version) >> $out139 echo >> $out163 echo >> $out140 echo "\`\`\`" >> $out164 echo "\`\`\`" >> $out141 jsonnet --help >> $out165 jsonnet --help >> $out142 echo "\`\`\`" >> $out166 echo "\`\`\`" >> $out143 echo >> $out167 echo >> $out144 echo Scala: >> $out168 echo Scala: >> $out145 echo >> $out169 echo >> $out146 echo "\`\`\`" >> $out170 echo "\`\`\`" >> $out147 sjsonnet 2>> $out || true171 sjsonnet 2>> $out || true148 echo "\`\`\`" >> $out172 echo "\`\`\`" >> $out149 echo >> $out173 echo >> $out150 echo "</details>" >> $out174 echo "</details>" >> $out151 echo >> $out175 echo >> $out152176 echo "Rust (alternative):" >> $out153 echo >> $out177 echo >> $out154 ''}178 echo "\`\`\`" >> $out179 rsjsonnet --help 2>> $out || true180 echo "\`\`\`" >> $out181 echo >> $out182 echo "</details>" >> $out183 echo >> $out184185 echo >> $out186 ''}155 echo "## Real world" >> $out187 echo "## Real world" >> $out156 ${mkBench {name = "Graalvm CI"; path = "${graalvmBench}/ci.jsonnet"; skipCpp = "takes longer than a hour"; skipGo = skipSlow; skipScala = skipSlow;}}188 ${mkBench {189 name = "Graalvm CI";190 path = "${graalvmBench}/ci.jsonnet";191 skipCpp = "takes longer than a hour";192 skipGo = skipSlow;193 skipScala = skipSlow;194 }}157 ${mkBench {name = "Kube-prometheus manifests"; vendor = "${kubePrometheusBench}/vendor"; path = "${kubePrometheusBench}/example.jsonnet"; skipCpp = skipSlow; skipGo = skipSlow; skipScala = skipSlow;}}195 ${mkBench {196 name = "Kube-prometheus manifests";197 vendor = "${kubePrometheusBench}/vendor";198 path = "${kubePrometheusBench}/example.jsonnet";199 skipCpp = skipSlow;200 skipGo = skipSlow;201 skipScala = skipSlow;202 }}158203159 echo >> $out204 echo >> $out160 echo "## Benchmarks from C++ jsonnet (/perf_tests)" >> $out205 echo "## Benchmarks from C++ jsonnet (/perf_tests)" >> $out161 ${mkBench {name = "Large string join"; path = "${jsonnetBench}/perf_tests/large_string_join.jsonnet"; skipScala = skipSlow;}}206 ${mkBench {207 name = "Large string join";208 path = "${jsonnetBench}/perf_tests/large_string_join.jsonnet";209 skipScala = skipSlow;210 }}162 ${mkBench {name = "Large string template"; omitSource = true; path = "${jsonnetBench}/perf_tests/large_string_template.jsonnet"; skipGo = "fails with os stack size exhausion"; skipCpp = skipSlow; skipScala = skipSlow;}}211 ${mkBench {212 name = "Large string template";213 omitSource = true;214 path = "${jsonnetBench}/perf_tests/large_string_template.jsonnet";215 skipGo = "fails with os stack size exhausion";216 skipCpp = skipSlow;217 skipScala = skipSlow;218 }}163 ${mkBench {name = "Realistic 1"; path = "${jsonnetBench}/perf_tests/realistic1.jsonnet"; skipGo = skipSlow; skipCpp = skipSlow; skipScala = skipSlow;}}219 ${mkBench {220 name = "Realistic 1";221 path = "${jsonnetBench}/perf_tests/realistic1.jsonnet";222 skipGo = skipSlow;223 skipCpp = skipSlow;224 skipScala = skipSlow;225 }}164 ${mkBench {name = "Realistic 2"; path = "${jsonnetBench}/perf_tests/realistic2.jsonnet"; skipGo = skipSlow; skipCpp = skipSlow; skipScala = skipSlow;}}226 ${mkBench {227 name = "Realistic 2";228 path = "${jsonnetBench}/perf_tests/realistic2.jsonnet";229 skipGo = skipSlow;230 skipCpp = skipSlow;231 skipScala = skipSlow;232 }}165233166 echo >> $out234 echo >> $out167 echo "## Benchmarks from C++ jsonnet (/benchmarks)" >> $out235 echo "## Benchmarks from C++ jsonnet (/benchmarks)" >> $out168 ${mkBench {name = "Tail call"; path = "${jsonnetBench}/benchmarks/bench.01.jsonnet"; skipScala = skipSlow;}}236 ${mkBench {237 name = "Tail call";238 path = "${jsonnetBench}/benchmarks/bench.01.jsonnet";239 skipScala = skipSlow;240 }}169 ${mkBench {name = "Inheritance recursion"; path = "${jsonnetBench}/benchmarks/bench.02.jsonnet"; skipCpp = skipSlow; skipGo = skipSlow;}}241 ${mkBench {242 name = "Inheritance recursion";243 path = "${jsonnetBench}/benchmarks/bench.02.jsonnet";244 skipCpp = skipSlow;245 skipGo = skipSlow;246 }}170 ${mkBench {name = "Simple recursive call"; path = "${jsonnetBench}/benchmarks/bench.03.jsonnet"; skipScala = skipSlow; skipGo = skipSlow;}}247 ${mkBench {248 name = "Simple recursive call";249 path = "${jsonnetBench}/benchmarks/bench.03.jsonnet";250 skipScala = skipSlow;251 skipGo = skipSlow;252 }}171 ${mkBench {name = "Foldl string concat"; path = "${jsonnetBench}/benchmarks/bench.04.jsonnet"; skipCpp = skipSlow; skipScala = skipSlow;}}253 ${mkBench {254 name = "Foldl string concat";255 path = "${jsonnetBench}/benchmarks/bench.04.jsonnet";256 skipCpp = skipSlow;257 skipScala = skipSlow;258 }}172 ${mkBench {name = "Array sorts"; path = "${jsonnetBench}/benchmarks/bench.06.jsonnet"; skipScala = "std.reverse is not implemented"; skipCpp = skipSlow;}}259 ${mkBench {260 name = "Array sorts";261 path = "${jsonnetBench}/benchmarks/bench.06.jsonnet";262 skipCpp = skipSlow;263 # std.assertEqual(reverse(std.range(1, 1000)), sort(std.range(1, 1000), keyF=function(x) -x))264 skipScala = "sjsonnet doesn't support keyF in std.sort: https://github.com/databricks/sjsonnet/issues/204";265 }}173 ${mkBench {name = "Lazy array"; path = "${jsonnetBench}/benchmarks/bench.07.jsonnet"; skipGo = skipSlow; skipScala = skipSlow;}}266 ${mkBench {267 name = "Lazy array";268 path = "${jsonnetBench}/benchmarks/bench.07.jsonnet";269 skipGo = skipSlow;270 skipScala = skipSlow;271 }}174 ${mkBench {name = "Inheritance function recursion"; path = "${jsonnetBench}/benchmarks/bench.08.jsonnet"; skipCpp = skipSlow; skipScala = skipSlow;}}272 ${mkBench {273 name = "Inheritance function recursion";274 path = "${jsonnetBench}/benchmarks/bench.08.jsonnet";275 skipCpp = skipSlow;276 skipScala = skipSlow;277 }}175 ${mkBench {name = "String strips"; path = "${jsonnetBench}/benchmarks/bench.09.jsonnet"; skipCpp = skipSlow; skipScala = skipSlow;}}278 ${mkBench {279 name = "String strips";280 path = "${jsonnetBench}/benchmarks/bench.09.jsonnet";281 skipCpp = skipSlow;282 skipScala = skipSlow;283 }}176 ${mkBench {name = "Big object"; path = "${jsonnetBench}/benchmarks/gen_big_object.jsonnet"; pathIsGenerator = true; skipScala = skipSlow;}}284 ${mkBench {285 name = "Big object";286 path = "${jsonnetBench}/benchmarks/gen_big_object.jsonnet";287 pathIsGenerator = true;288 skipScala = skipSlow;289 }}177290178 echo >> $out291 echo >> $out179 echo "## Benchmarks from Go jsonnet (builtins)" >> $out292 echo "## Benchmarks from Go jsonnet (builtins)" >> $out180 ${mkBench {name = "std.base64"; path = "${goJsonnetBench}/base64.jsonnet"; skipCpp = skipSlow; skipScala = skipSlow;}}293 ${mkBench {294 name = "std.base64";295 path = "${goJsonnetBench}/base64.jsonnet";296 skipRustAlternative = skipSlow;297 skipCpp = skipSlow;298 skipScala = skipSlow;299 }}181 ${mkBench {name = "std.base64Decode"; path = "${goJsonnetBench}/base64Decode.jsonnet"; skipCpp = skipSlow; skipScala = skipSlow;}}300 ${mkBench {301 name = "std.base64Decode";302 path = "${goJsonnetBench}/base64Decode.jsonnet";303 skipRustAlternative = skipSlow;304 skipCpp = skipSlow;305 skipScala = skipSlow;306 }}182 ${mkBench {name = "std.base64DecodeBytes"; path = "${goJsonnetBench}/base64DecodeBytes.jsonnet"; skipCpp = skipSlow; skipGo = skipSlow; skipScala = skipSlow;}}307 ${mkBench {308 name = "std.base64DecodeBytes";309 path = "${goJsonnetBench}/base64DecodeBytes.jsonnet";310 skipRustAlternative = skipSlow;311 skipCpp = skipSlow;312 skipGo = skipSlow;313 skipScala = skipSlow;314 }}183 ${mkBench {name = "std.base64 (byte array)"; path = "${goJsonnetBench}/base64_byte_array.jsonnet"; skipCpp = skipSlow; skipGo = skipSlow; skipScala = skipSlow;}}315 ${mkBench {316 name = "std.base64 (byte array)";317 path = "${goJsonnetBench}/base64_byte_array.jsonnet";318 skipRustAlternative = skipSlow;319 skipCpp = skipSlow;320 skipGo = skipSlow;321 skipScala = skipSlow;322 }}184 ${mkBench {name = "std.foldl"; path = "${goJsonnetBench}/foldl.jsonnet"; skipScala = skipSlow;}}323 ${mkBench {324 name = "std.foldl";325 path = "${goJsonnetBench}/foldl.jsonnet";326 skipScala = skipSlow;327 }}185 ${mkBench {name = "std.manifestJsonEx"; path = "${goJsonnetBench}/manifestJsonEx.jsonnet"; skipScala = skipSlow; skipCpp = skipSlow;}}328 ${mkBench {329 name = "std.manifestJsonEx";330 path = "${goJsonnetBench}/manifestJsonEx.jsonnet";331 skipScala = skipSlow;332 skipCpp = skipSlow;333 }}186 ${mkBench {name = "std.manifestTomlEx"; path = "${goJsonnetBench}/manifestTomlEx.jsonnet"; skipScala = "std.manifestTomlEx is not implemented"; skipCpp=skipSlow;}}334 ${mkBench {335 name = "std.manifestTomlEx";336 path = "${goJsonnetBench}/manifestTomlEx.jsonnet";337 skipScala = "std.manifestTomlEx is not implemented: https://github.com/databricks/sjsonnet/issues/111";338 skipCpp = skipSlow;339 }}187 ${mkBench {name = "std.parseInt"; path = "${goJsonnetBench}/parseInt.jsonnet"; skipScala = skipSlow; skipCpp = skipSlow;}}340 ${mkBench {341 name = "std.parseInt";342 path = "${goJsonnetBench}/parseInt.jsonnet";343 skipScala = skipSlow;344 skipCpp = skipSlow;345 }}188 ${mkBench {name = "std.reverse"; path = "${goJsonnetBench}/reverse.jsonnet"; skipScala = "std.reverse is not implemented"; skipCpp = skipSlow; skipGo = skipSlow;}}346 ${mkBench {347 name = "std.reverse";348 path = "${goJsonnetBench}/reverse.jsonnet";349 skipCpp = skipSlow;350 skipGo = skipSlow;351 }}189 ${mkBench {name = "std.substr"; path = "${goJsonnetBench}/substr.jsonnet"; skipScala = skipSlow;}}352 ${mkBench {353 name = "std.substr";354 path = "${goJsonnetBench}/substr.jsonnet";355 skipScala = skipSlow;356 }}190 ${mkBench {name = "Comparsion for array"; path = "${goJsonnetBench}/comparison.jsonnet"; skipScala = "array comparsion is not implemented"; skipCpp = skipSlow;}}357 ${mkBench {358 name = "Comparsion for array";359 path = "${goJsonnetBench}/comparison.jsonnet";360 skipScala = "array comparsion is not implemented";361 skipCpp = skipSlow;362 }}191 ${mkBench {name = "Comparsion for primitives"; path = "${goJsonnetBench}/comparison2.jsonnet"; skipCpp = "can't run: uses up to 192GB of RAM"; skipGo = skipSlow; skipScala = skipSlow;}}363 ${mkBench {364 name = "Comparsion for primitives";365 path = "${goJsonnetBench}/comparison2.jsonnet";366 skipRustAlternative = skipSlow;367 skipCpp = "can't run: uses up to 192GB of RAM";368 skipGo = skipSlow;369 skipScala = skipSlow;370 }}192 '';371 '';193}372 }194373nix/go-jsonnet.nixdiffbeforeafterboth1{ lib, buildGo119Module, fetchFromGitHub, makeWrapper }:1{22 buildGoModule,3 fetchFromGitHub,4 makeWrapper,5}:3buildGo119Module rec {6buildGoModule rec {4 pname = "go-jsonnet";7 pname = "go-jsonnet";5 version = "0.20.0";8 version = "0.20.0";69nix/jsonnet.nixdiffbeforeafterboth1{ stdenv, lib, jekyll, fetchFromGitHub, makeWrapper }:1{22 stdenv,3 fetchFromGitHub,4 makeWrapper,5}:3stdenv.mkDerivation rec {6stdenv.mkDerivation rec {4 pname = "jsonnet";7 pname = "jsonnet";nix/rsjsonnet.nixdiffbeforeafterbothno changes
nix/sjsonnet.nixdiffbeforeafterboth56# TODO: Somehow build client-server version of sjsonnet, and use it in benchmarks4# TODO: Somehow build client-server version of sjsonnet, and use it in benchmarks78{ stdenv, lib, fetchurl, jdk20, makeWrapper }:5{96 stdenv,7 fetchurl,8 jdk21_headless,9 makeWrapper,10 java ? jdk21_headless,11}:10stdenv.mkDerivation rec {12stdenv.mkDerivation rec {11 pname = "sjsonnet";13 pname = "sjsonnet";12 version = "0.4.6";14 version = "0.4.10";131514 src = fetchurl {16 src = fetchurl {15 url =17 url = "https://github.com/databricks/${pname}/releases/download/${version}/${pname}-${version}.jar";16 "https://github.com/databricks/${pname}/releases/download/${version}/${pname}-${version}.jar";17 hash = "sha256-ivVKMf7W9iLF/KSXYEl6iJeNGEP5jxw2uqPF7pz6rBU=";18 hash = "sha256-zKlmh+jXm23x78CKwna8fGHNqziWuPipSbWTPUCADrY=";18 };19 };192020 unpackPhase = "true";21 unpackPhase = "true";21 buildInputs =22 buildInputs = [java makeWrapper];22 [ jdk20 makeWrapper ];232324 installPhase = ''24 installPhase = ''25 mkdir -p $out/bin $out/lib25 mkdir -p $out/bin $out/lib26 cp $src $out/lib/sjsonnet.jar26 cp $src $out/lib/sjsonnet.jar27 makeWrapper ${jdk20}/bin/java $out/bin/sjsonnet --add-flags "-Xss100m -XX:+UseStringDeduplication -jar $out/lib/sjsonnet.jar"27 makeWrapper ${java}/bin/java $out/bin/sjsonnet --add-flags "-Xss100m -XX:+UseStringDeduplication -jar $out/lib/sjsonnet.jar"28 '';28 '';29 separateDebugInfo = false;29 separateDebugInfo = false;30}30}3131