diff --git a/README.adoc b/README.adoc index b879d8d2..5e9b66f6 100644 --- a/README.adoc +++ b/README.adoc @@ -69,6 +69,7 @@ There already are multiple implementations of this standard implemented in diffe * https://github.com/google/jsonnet[C++]; * https://github.com/google/go-jsonnet/[Go]; * https://github.com/databricks/sjsonnet[Scala]. +* [NEW] https://github.com/eduardosm/rsjsonnet[Another Rust impl appears]. This implementation shows performance better than all existing implementations. For more information see link:./docs/benchmarks.md[benchmarks] diff --git a/flake.nix b/flake.nix index 317c5377..632351b0 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,7 @@ jsonnet = pkgs.callPackage ./nix/jsonnet.nix {}; # I didn't managed to build it, and nixpkgs version is marked as broken # haskell-jsonnet = pkgs.callPackage ./nix/haskell-jsonnet.nix { }; + rsjsonnet = pkgs.callPackage ./nix/rsjsonnet.nix {}; jrsonnet = pkgs.callPackage ./nix/jrsonnet.nix { inherit craneLib; @@ -60,7 +61,7 @@ }; benchmarks = pkgs.callPackage ./nix/benchmarks.nix { - inherit go-jsonnet sjsonnet jsonnet; + inherit go-jsonnet sjsonnet jsonnet rsjsonnet; jrsonnetVariants = [ { drv = jrsonnet.override {forBenchmarks = true;}; @@ -69,7 +70,7 @@ ]; }; benchmarks-quick = pkgs.callPackage ./nix/benchmarks.nix { - inherit go-jsonnet sjsonnet jsonnet; + inherit go-jsonnet sjsonnet jsonnet rsjsonnet; quick = true; jrsonnetVariants = [ { @@ -79,7 +80,7 @@ ]; }; benchmarks-against-release = pkgs.callPackage ./nix/benchmarks.nix { - inherit go-jsonnet sjsonnet jsonnet; + inherit go-jsonnet sjsonnet jsonnet rsjsonnet; jrsonnetVariants = [ { drv = jrsonnet.override {forBenchmarks = true;}; @@ -96,7 +97,7 @@ ]; }; benchmarks-quick-against-release = pkgs.callPackage ./nix/benchmarks.nix { - inherit go-jsonnet sjsonnet jsonnet; + inherit go-jsonnet sjsonnet jsonnet rsjsonnet; quick = true; jrsonnetVariants = [ { diff --git a/nix/benchmarks.nix b/nix/benchmarks.nix index 8e59b6e2..bf7199fc 100644 --- a/nix/benchmarks.nix +++ b/nix/benchmarks.nix @@ -7,6 +7,7 @@ , go-jsonnet , sjsonnet , jsonnet +, rsjsonnet , hyperfine , quick ? false , jrsonnetVariants @@ -114,6 +115,7 @@ stdenv.mkDerivation { ${concatStringsSep " " (forEach jrsonnetVariants (variant: "\"${variant.drv}/bin/jrsonnet $path ${optionalString (vendor != "") "-J${vendor}"}\" -n \"Rust${if variant.name != "" then " (${variant.name})" else ""}\"" ))} \ + "rsjsonnet $path ${optionalString (vendor != "") "-J ${vendor}"}" -n "Rust (alternative, rsjsonnet)" ${optionalString (skipGo == "") "\"go-jsonnet $path ${optionalString (vendor != "") "-J ${vendor}"}\" -n \"Go\""} \ ${optionalString (skipScala == "") "\"sjsonnet $path ${optionalString (vendor != "") "-J ${vendor}"}\" -n \"Scala\""} \ ${optionalString (skipCpp == "") "\"jsonnet $path ${optionalString (vendor != "") "-J ${vendor}"}\" -n \"C++\""} diff --git a/nix/rsjsonnet.nix b/nix/rsjsonnet.nix new file mode 100644 index 00000000..83adcea9 --- /dev/null +++ b/nix/rsjsonnet.nix @@ -0,0 +1,18 @@ +{ + fetchFromGitHub, + rustPlatform, + lib, +}: +rustPlatform.buildRustPackage rec { + pname = "rsjsonnet"; + version = "0.1.1"; + + src = fetchFromGitHub { + owner = "eduardosm"; + repo = pname; + rev = "v${version}"; + hash = "sha256-C6hZYGllKrKKMwMwss6PK2UD5Zb7bk2v8DrGpWnwP/A="; + }; + + cargoHash = "sha256-TsUN9oUu6S1l9oTaR6nET1ZdRvMrR29bkP3VEDre8aE="; +}