From 364fdf96177ae4e24508e78ee3d5ff67d9b88f42 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Sat, 04 Apr 2026 20:22:50 +0000 Subject: [PATCH] perf: inline trivial IntoUntyped --- --- a/crates/jrsonnet-evaluator/src/typed/conversions.rs +++ b/crates/jrsonnet-evaluator/src/typed/conversions.rs @@ -134,6 +134,7 @@ const TYPE: &'static ComplexValType = &ComplexValType::Lazy(T::TYPE); } +#[inline] fn try_cast_thunk_val(typed: Thunk) -> Result, Thunk> { if TypeId::of::() == TypeId::of::() { // SAFETY: We know that it is exactly the same type, and we discard the original after that @@ -148,6 +149,7 @@ where T: IntoUntyped + Trace + Clone, { + #[inline] fn into_untyped(typed: Self) -> Result { T::into_untyped(typed.evaluate()?) } @@ -185,6 +187,7 @@ } } +#[inline] fn try_cast_thunk_t(typed: Thunk) -> Result, Thunk> { if TypeId::of::() == TypeId::of::() { // SAFETY: We know that it is exactly the same type, and we discard the original after that @@ -581,11 +584,13 @@ const TYPE: &'static ComplexValType = &ComplexValType::Any; } impl IntoUntyped for &Val { + #[inline] fn into_untyped(typed: Self) -> Result { Ok(typed.clone()) } } impl IntoUntyped for Val { + #[inline] fn into_untyped(typed: Self) -> Result { Ok(typed) } -- gitstuff