diff options
author | Vincent Ambo <mail@tazj.in> | 2023-02-27T07·22+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-03-13T20·30+0000 |
commit | 4bbfeaf1cbf6f0d1ea94c0fc405512259e856e0a (patch) | |
tree | fefa0071e15b54a050a553896ee086b44ef3907a /tvix/eval/src/builtins | |
parent | 83b2290e1b10683d2dca4b8e20e995662852ab9a (diff) |
refactor(tvix/eval): wrap NixList in Rc r/5966
The size of a `Vector<Value>` 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 <tvl@lahfa.xyz> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/builtins')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 79aff9619847..833a1dffa236 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<Value, ErrorKind> { - 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")] |