diff options
author | Vincent Ambo <mail@tazj.in> | 2022-08-26T16·22+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-03T13·19+0000 |
commit | 3a2fcc8bc2eb3895a5dfdb268869d550e359ffe7 (patch) | |
tree | 7da39a05125156dd7d7236480cf168a15b4633e8 /tvix/eval/src/main.rs | |
parent | 3270817b9053cc0d656bf9f8522e81a2917b3036 (diff) |
refactor(tvix/eval): avoid cloning in NixAttrs::update if possible r/4616
Refactors the update function to take the attribute sets by value instead. To facilitate this, we use an equivalent of the currently unstable `Rc::clone_or_unwrap` in the VM when encountering attribute sets, so that in cases where the only references to the attrs being updated are the ones on the stack those clones are avoided completely. This does make update() a little bit more tricky internally, as some optimised branches can directly return the moved value, and others need to destructure with ownership. For this reason there are now two different match statements handling the different ownership cases. Change-Id: Ia77d3ba5c86afb75b9f1f51758bda61729ba5aab Reviewed-on: https://cl.tvl.fyi/c/depot/+/6279 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/main.rs')
0 files changed, 0 insertions, 0 deletions