From 4bbfeaf1cbf6f0d1ea94c0fc405512259e856e0a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 27 Feb 2023 10:22:38 +0300 Subject: refactor(tvix/eval): wrap NixList in Rc The size of a `Vector` is 64 *bytes*, which is quite large, and it bloated the entire Value type to this size. This change adds an indirection for the inner vector through Rc. Initially I tried to use a Box, but this breaks pointer equality guarantees for the Vector when it is small enough to be inlined. This reduces the size of Value from 64 to 32 bytes. Change-Id: Ic3211e861b1966c78b2c3d536ba291fea92647fd Reviewed-on: https://cl.tvl.fyi/c/depot/+/8150 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/eval/src/builtins/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tvix/eval/src/builtins') diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 79aff96198..833a1dffa2 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -826,9 +826,9 @@ mod pure_builtins { #[builtin("sort")] async fn builtin_sort(co: GenCo, comparator: Value, list: Value) -> Result { - let mut list = list.to_list()?; - list.sort_by(&co, comparator).await?; - Ok(Value::List(list)) + let list = list.to_list()?; + let sorted = list.sort_by(&co, comparator).await?; + Ok(Value::List(sorted)) } #[builtin("splitVersion")] -- cgit 1.4.1