diff options
author | Adam Joseph <adam@westernsemico.com> | 2022-10-16T00·09-0700 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-10-16T09·23+0000 |
commit | d9c497520ca0b89f49aed7c9507504b55eff49ce (patch) | |
tree | 8441726dca0d67bd72162e0da39fbc135d02d2bf /tvix/eval | |
parent | db70c672cf05f78df791ebcb20fa97c4cb786515 (diff) |
feat(tvix/eval): remove Clone instance from Chunk and Lambda r/5142
Lambda has a quite large and variable-sized runtime representation, unlike Rc<Lambda>. It would be easy to accidentally call clone() on this and create input-dependent performance regressions. Nothing in the codebase is currently using Lambda.clone(). Let's remove the derived instance. If it's really needed it is very easy to add it back in, but whoever does that will have to look at the struct they're adding Clone to, which will hopefully prompt them to think about whether or not that's really what they want to do. Change-Id: I7806a741862ab4402229839ce3f4ea75aafd6d12 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7029 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/src/chunk.rs | 2 | ||||
-rw-r--r-- | tvix/eval/src/value/function.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/chunk.rs b/tvix/eval/src/chunk.rs index 9958b551a1e9..5026cdb73651 100644 --- a/tvix/eval/src/chunk.rs +++ b/tvix/eval/src/chunk.rs @@ -28,7 +28,7 @@ struct SourceSpan { /// A chunk is a representation of a sequence of bytecode /// instructions, associated constants and additional metadata as /// emitted by the compiler. -#[derive(Clone, Debug, Default, PartialEq)] +#[derive(Debug, Default, PartialEq)] pub struct Chunk { pub code: Vec<OpCode>, pub constants: Vec<Value>, diff --git a/tvix/eval/src/value/function.rs b/tvix/eval/src/value/function.rs index c875b82aee05..6287cf76b81d 100644 --- a/tvix/eval/src/value/function.rs +++ b/tvix/eval/src/value/function.rs @@ -9,7 +9,7 @@ use crate::{ upvalues::{UpvalueCarrier, Upvalues}, }; -#[derive(Clone, Debug, PartialEq)] +#[derive(Debug, PartialEq)] pub struct Lambda { // name: Option<NixString>, pub(crate) chunk: Chunk, |