From 5d2ae840f13641a6f699ab77d43e41d98f459053 Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Sat, 10 Feb 2024 12:21:06 -0500 Subject: refactor(tvix/eval): Box the inside of Value::Json serde_json::Value is pretty large, and is contributing (albeit not exclusively) to the large size of the Value repr. Putting it in a box is *especially* cheap (since it's rarely used) and allows us to (eventually) cut down on the size of Value. Change-Id: I005a802d8527b639beb4e938e3320b11ffa1ef23 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10795 Reviewed-by: sterni Autosubmit: aspen Tested-by: BuildkiteCI --- tvix/eval/src/value/json.rs | 2 +- tvix/eval/src/value/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/value') diff --git a/tvix/eval/src/value/json.rs b/tvix/eval/src/value/json.rs index c2f8b2c2b1ef..5c627540dbe8 100644 --- a/tvix/eval/src/value/json.rs +++ b/tvix/eval/src/value/json.rs @@ -111,7 +111,7 @@ impl Value { pub(crate) async fn into_json_generator(self, co: GenCo) -> Result { match self.into_json(&co).await? { Err(cek) => Ok(Value::Catchable(cek)), - Ok(json) => Ok(Value::Json(json)), + Ok(json) => Ok(Value::Json(Box::new(json))), } } } diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index e0c5a2f512cf..043788da4596 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -78,7 +78,7 @@ pub enum Value { #[serde(skip)] UnresolvedPath(Box), #[serde(skip)] - Json(serde_json::Value), + Json(Box), #[serde(skip)] FinaliseRequest(bool), -- cgit 1.4.1