From 91465dc78ec7b4a8c9b651657bb8ad5f25c556a7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 29 Dec 2022 17:08:14 +0300 Subject: refactor(tvix/eval): persistent, memory-sharing OrdMap for NixAttrs This uses the `im::OrdMap` for `NixAttrs` to enable sharing of memory between different iterations of a map. This slightly speeds up eval, but not significantly. Future work might include benchmarking whether using a `HashMap` and only ordering in cases where order is actually required would help. This switches to a fork of `im` that fixes some bugs with its OrdMap implementation. Change-Id: I2f6a5ff471b6d508c1e8a98b13f889f49c0d9537 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7676 Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/tests/tvix_tests/eval-okay-functionargs.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-functionargs.nix') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-functionargs.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-functionargs.nix index 68dca62ee18d..cd95b971f8a9 100644 --- a/tvix/eval/src/tests/tvix_tests/eval-okay-functionargs.nix +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-functionargs.nix @@ -6,7 +6,7 @@ let atermFun = { stdenv, fetchurl }: { name = "aterm-${stdenv.name}"; }; aterm2Fun = { stdenv, fetchurl }: { name = "aterm2-${stdenv.name}"; }; nixFun = { stdenv, fetchurl, aterm }: { name = "nix-${stdenv.name}-${aterm.name}"; }; - + mplayerFun = { stdenv, fetchurl, enableX11 ? false, xorg ? null, enableFoo ? true, foo ? null }: assert stdenv.name == "stdenv2"; @@ -18,7 +18,7 @@ let { override = newArgs: makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs)); }; - + callPackage_ = pkgs: f: args: makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f) pkgs) // args); @@ -42,7 +42,7 @@ let libX11Fun = { stdenv, fetchurl }: { name = "libX11"; }; libX11_2Fun = { stdenv, fetchurl }: { name = "libX11_2"; }; libXvFun = { stdenv, fetchurl, libX11 }: { name = "libXv"; }; - + xorgFun = { pkgs }: let callPackage = callPackage_ (pkgs // pkgs.xorg); in @@ -56,7 +56,7 @@ in let pkgs = allPackages { }; - + pkgs2 = allPackages { overrides = pkgs: pkgsPrev: { stdenv = pkgs.stdenv2; @@ -64,7 +64,7 @@ let xorg = pkgsPrev.xorg // { libX11 = libX11_2Fun { inherit (pkgs) stdenv fetchurl; }; }; }; }; - + in [ pkgs.stdenv.name -- cgit 1.4.1