From d9c497520ca0b89f49aed7c9507504b55eff49ce Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sat, 15 Oct 2022 17:09:41 -0700 Subject: feat(tvix/eval): remove Clone instance from Chunk and Lambda Lambda has a quite large and variable-sized runtime representation, unlike Rc. 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 Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/chunk.rs | 2 +- tvix/eval/src/value/function.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/eval') 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, pub constants: Vec, 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, pub(crate) chunk: Chunk, -- cgit 1.4.1