From 5d73c06b1a67bce68dcc0b2bd5f087ce00ab6317 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 29 Dec 2022 14:44:09 +0300 Subject: refactor(tvix/eval): use im::Vector for NixList representation This is a persistent, structurally sharing data structure which is more efficient in some of our use-cases. I have verified the efficiency improvement using `hyperfine` repeatedly over expressions on nixpkgs. Lists are not the most performance-critical structure in Nix (that would be attribute sets), but we can already see a small (~5-10%) improvement. Note that there are a handful of cases where we still go via `Vec` that need to be fixed, most notable for `builtins.sort` which can not currently be implemented directly using `im::Vector` because of a restrictive type bound. Change-Id: I237cc50cbd7629a046e5a5e4601fbb40355e551d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7670 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/Cargo.toml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'tvix/eval/Cargo.toml') diff --git a/tvix/eval/Cargo.toml b/tvix/eval/Cargo.toml index 93d45c2166d0..dac605f3e1ae 100644 --- a/tvix/eval/Cargo.toml +++ b/tvix/eval/Cargo.toml @@ -9,21 +9,22 @@ edition = "2021" name = "tvix_eval" [dependencies] -smol_str = "0.1" -dirs = "4.0.0" -path-clean = "0.1" -tabwriter = "1.2" -rowan = "*" # pinned by rnix +backtrace-on-stack-overflow = { version = "0.2.0", optional = true } +builtin-macros = { path = "./builtin-macros", package = "tvix-eval-builtin-macros" } codemap = "0.1.3" codemap-diagnostic = "0.1.1" +dirs = "4.0.0" +im = "15.1" +path-clean = "0.1" proptest = { version = "1.0.0", default_features = false, features = ["std", "alloc", "break-dead-code", "tempfile"], optional = true } -test-strategy = { version = "0.2.1", optional = true } -serde = "1.0" -serde_json = "1.0" regex = "1.6.0" -builtin-macros = { path = "./builtin-macros", package = "tvix-eval-builtin-macros" } -backtrace-on-stack-overflow = { version = "0.2.0", optional = true } rnix = "0.11.0" +rowan = "*" # pinned by rnix +serde = "1.0" +serde_json = "1.0" +smol_str = "0.1" +tabwriter = "1.2" +test-strategy = { version = "0.2.1", optional = true } [dev-dependencies] criterion = "0.4" -- cgit 1.4.1