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 <sternenseemann@systemli.org> Autosubmit: aspen <root@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									7b1632ec71
								
							
						
					
					
						commit
						5d2ae840f1
					
				
					 3 changed files with 3 additions and 3 deletions
				
			
		|  | @ -111,7 +111,7 @@ impl Value { | ||||||
|     pub(crate) async fn into_json_generator(self, co: GenCo) -> Result<Value, ErrorKind> { |     pub(crate) async fn into_json_generator(self, co: GenCo) -> Result<Value, ErrorKind> { | ||||||
|         match self.into_json(&co).await? { |         match self.into_json(&co).await? { | ||||||
|             Err(cek) => Ok(Value::Catchable(cek)), |             Err(cek) => Ok(Value::Catchable(cek)), | ||||||
|             Ok(json) => Ok(Value::Json(json)), |             Ok(json) => Ok(Value::Json(Box::new(json))), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -78,7 +78,7 @@ pub enum Value { | ||||||
|     #[serde(skip)] |     #[serde(skip)] | ||||||
|     UnresolvedPath(Box<Path>), |     UnresolvedPath(Box<Path>), | ||||||
|     #[serde(skip)] |     #[serde(skip)] | ||||||
|     Json(serde_json::Value), |     Json(Box<serde_json::Value>), | ||||||
| 
 | 
 | ||||||
|     #[serde(skip)] |     #[serde(skip)] | ||||||
|     FinaliseRequest(bool), |     FinaliseRequest(bool), | ||||||
|  |  | ||||||
|  | @ -775,7 +775,7 @@ pub(crate) async fn request_to_json( | ||||||
|     value: Value, |     value: Value, | ||||||
| ) -> Result<serde_json::Value, CatchableErrorKind> { | ) -> Result<serde_json::Value, CatchableErrorKind> { | ||||||
|     match co.yield_(VMRequest::ToJson(value)).await { |     match co.yield_(VMRequest::ToJson(value)).await { | ||||||
|         VMResponse::Value(Value::Json(json)) => Ok(json), |         VMResponse::Value(Value::Json(json)) => Ok(*json), | ||||||
|         VMResponse::Value(Value::Catchable(cek)) => Err(cek), |         VMResponse::Value(Value::Catchable(cek)) => Err(cek), | ||||||
|         msg => panic!( |         msg => panic!( | ||||||
|             "Tvix bug: VM responded with incorrect generator message: {}", |             "Tvix bug: VM responded with incorrect generator message: {}", | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue