From 998a3c44fd79eac92c375ec9e755288bc146a279 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 11 May 2023 11:35:45 +0200 Subject: Remove tracing from cheap functions Turns out that having tracing enabled on some functions that get called a lot distorts the traces so that their parent stack frames look much more expensive than they actually are. --- src/model/content.rs | 7 ------- src/model/styles.rs | 6 ------ 2 files changed, 13 deletions(-) (limited to 'src/model') diff --git a/src/model/content.rs b/src/model/content.rs index 1bd19f14..4eeecbd6 100644 --- a/src/model/content.rs +++ b/src/model/content.rs @@ -39,19 +39,16 @@ enum Attr { impl Content { /// Create an empty element. - #[tracing::instrument()] pub fn new(func: ElemFunc) -> Self { Self { func, attrs: EcoVec::new() } } /// Create empty content. - #[tracing::instrument()] pub fn empty() -> Self { Self::new(SequenceElem::func()) } /// Create a new sequence element from multiples elements. - #[tracing::instrument(skip_all)] pub fn sequence(iter: impl IntoIterator) -> Self { let mut iter = iter.into_iter(); let Some(first) = iter.next() else { return Self::empty() }; @@ -94,7 +91,6 @@ impl Content { } /// Access the child and styles. - #[tracing::instrument(skip_all)] pub fn to_styled(&self) -> Option<(&Content, &Styles)> { if !self.is::() { return None; @@ -120,7 +116,6 @@ impl Content { /// Cast to a trait object if the contained element has the given /// capability. - #[tracing::instrument(skip_all)] pub fn with(&self) -> Option<&C> where C: ?Sized + 'static, @@ -132,7 +127,6 @@ impl Content { /// Cast to a mutable trait object if the contained element has the given /// capability. - #[tracing::instrument(skip_all)] pub fn with_mut(&mut self) -> Option<&mut C> where C: ?Sized + 'static, @@ -180,7 +174,6 @@ impl Content { } /// Access a field on the content. - #[tracing::instrument(skip_all)] pub fn field(&self, name: &str) -> Option { if let (Some(iter), "children") = (self.to_sequence(), name) { Some(Value::Array(iter.cloned().map(Value::Content).collect())) diff --git a/src/model/styles.rs b/src/model/styles.rs index efbdb9d1..54784307 100644 --- a/src/model/styles.rs +++ b/src/model/styles.rs @@ -563,7 +563,6 @@ impl<'a> StyleChain<'a> { /// The resulting style chain contains styles from `local` as well as /// `self`. The ones from `local` take precedence over the ones from /// `self`. For folded properties `local` contributes the inner value. - #[tracing::instrument(skip_all)] pub fn chain<'b>(&'b self, local: &'b Styles) -> StyleChain<'b> { if local.is_empty() { *self @@ -573,7 +572,6 @@ impl<'a> StyleChain<'a> { } /// Cast the first value for the given property in the chain. - #[tracing::instrument(skip_all)] pub fn get( self, func: ElemFunc, @@ -587,7 +585,6 @@ impl<'a> StyleChain<'a> { } /// Cast the first value for the given property in the chain. - #[tracing::instrument(skip_all)] pub fn get_resolve( self, func: ElemFunc, @@ -599,7 +596,6 @@ impl<'a> StyleChain<'a> { } /// Cast the first value for the given property in the chain. - #[tracing::instrument(skip_all)] pub fn get_fold( self, func: ElemFunc, @@ -621,7 +617,6 @@ impl<'a> StyleChain<'a> { } /// Cast the first value for the given property in the chain. - #[tracing::instrument(skip_all)] pub fn get_resolve_fold( self, func: ElemFunc, @@ -656,7 +651,6 @@ impl<'a> StyleChain<'a> { } /// Iterate over all values for the given property in the chain. - #[tracing::instrument(skip_all)] pub fn properties( self, func: ElemFunc, -- cgit v1.2.3