git.delta.rocks / jrsonnet / refs/commits / 7eb32146c8af

difftreelog

source

README.md2.7 KiBsourcehistory
1# jrsonnet23## What is it45[Jsonnet](https://jsonnet.org/) is a json templating language67This crate implements both jsonnet library, and alternative jsonnet executable89## Why1011There is already 3 implementations of this standard: in [C++](https://github.com/google/jsonnet), in [Go](https://github.com/google/go-jsonnet/) and in [Scala](https://github.com/databricks/sjsonnet)1213It is fun to write one in Rust :D1415## Spec support1617- Can pass all of original `examples` tests18- Can pass all of original `test_suite` tests, expect those, which checks golden output for stacktraces (vanilla-like stacktraces are implemented, but look is not 100% identical): ![Example output](./traces.png)1920## Production usage2122It can be used within scripts, but i won't recommend embedding it into applications,23because currently not all errors are thrown as errors, panic possible on incorrect input.2425## Bindings2627Currently no language bindings are implemented2829## Benchmark3031It is faster than golang implementation on mine kubernetes cluster configuration, which includes a lot of stuff, i.e prometheus operator3233Mine configuration contains two manifests, first one contains a lot of plain values, second one - a lot of computations3435- `gojsonnet` - golang impl36- `../../../../jsonnet-rs/target/release/jrsonnet` - this repo impl3738```md39# Manifest 1 (plain values)4041Benchmark #1: gojsonnet 02-prepare.jsonnet -J ../vendor/42  Time (mean ± σ):     647.4 ms ±  12.8 ms    [User: 1.252 s, System: 0.069 s]43  Range (min … max):   626.0 ms … 668.7 ms    10 runs4445Benchmark #2: ../../../../jsonnet-rs/target/release/jrsonnet 02-prepare.jsonnet -J ../vendor/46  Time (mean ± σ):     163.7 ms ±   2.9 ms    [User: 138.5 ms, System: 24.6 ms]47  Range (min … max):   161.4 ms … 174.0 ms    17 runs4849Summary50  '../../../../jsonnet-rs/target/release/jrsonnet 02-prepare.jsonnet -J ../vendor/' ran51    3.96 ± 0.10 times faster than 'gojsonnet 02-prepare.jsonnet -J ../vendor/'5253# Manifest 2 (computations)5455Benchmark #1: gojsonnet 03-deploy.jsonnet -J ../vendor/56  Time (mean ± σ):     14.387 s ±  0.473 s    [User: 27.657 s, System: 0.226 s]57  Range (min … max):   13.865 s … 15.147 s    10 runs5859Benchmark #2: ../../../../jsonnet-rs/target/release/jrsonnet 03-deploy.jsonnet -J ../vendor/60  Time (mean ± σ):      2.373 s ±  0.083 s    [User: 2.304 s, System: 0.063 s]61  Range (min … max):    2.286 s …  2.486 s    10 runs6263Summary64  '../../../../jsonnet-rs/target/release/jrsonnet 03-deploy.jsonnet -J ../vendor/' ran65    6.06 ± 0.29 times faster than 'gojsonnet 03-deploy.jsonnet -J ../vendor/'66```6768However, go impl still can be faster in some cases, because it curretly have more stdlib functions implemented in native, instead of stdlib (I.e `std.base64`)