I recently put in some work optimizing our Sjsonnet interpreter, and ran some rough benchmarks. Not sure if Jsonnet compilation performance is a concern for anyone else, but we have a huge pile of Jsonnet code at work configuring everything under the sun, so any slowness does cause inconvenience. Here are the numbers, each one being the average and std dev of time-per-run, from 3 batchs of runs, each batch taking 20s each on a ubuntu 16.04 m4.4xlarge EC2 box:
Time taken to execute a subset of the Jsonnet test suite:
| . | Sjsonnet 0.1.5 | Sjsonnet 0.1.6 |
|---|
| Scala 2.13.0 | 14.26ms ± 0.22 | 6.59ms ± 0.27 |
| Scala 2.12.8 | 18.07ms ± 0.30 | 9.29ms ± 0.26 |
| google/jsonnet | google/go-jsonnet |
|---|
| ~1277ms | ~274ms |
This is running on an arbitrary subset of the jsonnet test suite defined here:
The rough benchmark code is there as well.
google/jsonnet was built from source on commit f59758d1904bccda99598990f582dd2e1e9ad263, and go-jsonnet was the v0.13.0 that go get downloaded. Due to the pretty long durations of each google/jsonnet run, and the consistent times taken, I wasn't able to get a meaningful standard deviation for those runs.
google/jsonnet and google/go-jsonnet were run in subprocesses, while Sjsonnet was run as a persistent daemon with parse-to-AST-caching enabled (this is the same setup our engineers use)
I also ran some benchmarks on a handful of our production Jsonnet files: these look pretty different from the Jsonnet test suite, big/nested structures rather than tons of small asserts. Each Jsonnet file in this set ended up importing a few dozen others, and materialized to 20-40kb of JSON, adding up to ~100kb in total. The time taken to evaluate these is below:
| . | Sjsonnet 0.1.5 | Sjsonnet 0.1.6 |
|---|
| Scala 2.13.0 | 33.73ms ± 0.44 | 16.66ms ± 0.08 |
| Scala 2.12.8 | 40.46ms ± 0.53 | 20.99ms ± 0.75 |
google/go-jsonnet is not compatible enough to evaluate these Jsonnet files, failing with google/go-jsonnet#314.
Hope this is of interest to someone!