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/value/list.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tvix/eval/src/value/list.rs') diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs index 0ab180a341e9..fa1f266c8779 100644 --- a/tvix/eval/src/value/list.rs +++ b/tvix/eval/src/value/list.rs @@ -1,7 +1,7 @@ //! This module implements Nix lists. use std::ops::Index; -use im::{vector, Vector}; +use imbl::{vector, Vector}; use crate::errors::ErrorKind; use crate::vm::VM; @@ -119,7 +119,7 @@ impl NixList { impl IntoIterator for NixList { type Item = Value; - type IntoIter = im::vector::ConsumingIter; + type IntoIter = imbl::vector::ConsumingIter; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() @@ -128,7 +128,7 @@ impl IntoIterator for NixList { impl<'a> IntoIterator for &'a NixList { type Item = &'a Value; - type IntoIter = im::vector::Iter<'a, Value>; + type IntoIter = imbl::vector::Iter<'a, Value>; fn into_iter(self) -> Self::IntoIter { self.0.iter() -- cgit 1.4.1