Another round of inlining

This commit is contained in:
novacrazy 2023-04-07 01:44:18 -05:00
parent 5bc0d89ce7
commit 29b81a3d50
5 changed files with 16 additions and 1 deletions

View File

@ -161,8 +161,10 @@ where
debug_assertions,
instrument(level = "trace", name = "<DynChild />", skip_all)
)]
#[inline]
fn into_view(self, cx: Scope) -> View {
// concrete inner function
#[inline(never)]
fn create_dyn_view(
cx: Scope,
component: DynChildRepr,

View File

@ -23,6 +23,7 @@ pub trait EventDescriptor: Clone {
/// Return the options for this type. This is only used when you create a [`Custom`] event
/// handler.
#[inline(always)]
fn options(&self) -> &Option<web_sys::AddEventListenerOptions> {
&None
}
@ -37,10 +38,12 @@ pub struct undelegated<Ev: EventDescriptor>(pub Ev);
impl<Ev: EventDescriptor> EventDescriptor for undelegated<Ev> {
type EventType = Ev::EventType;
#[inline(always)]
fn name(&self) -> Cow<'static, str> {
self.0.name()
}
#[inline(always)]
fn event_delegation_key(&self) -> Cow<'static, str> {
self.0.event_delegation_key()
}
@ -78,6 +81,7 @@ impl<E: FromWasmAbi> EventDescriptor for Custom<E> {
const BUBBLES: bool = false;
#[inline(always)]
fn options(&self) -> &Option<web_sys::AddEventListenerOptions> {
&self.options
}
@ -136,10 +140,12 @@ macro_rules! generate_event_types {
impl EventDescriptor for $event {
type EventType = web_sys::$web_sys_event;
#[inline(always)]
fn name(&self) -> Cow<'static, str> {
stringify!($event).into()
}
#[inline(always)]
fn event_delegation_key(&self) -> Cow<'static, str> {
concat!("$$$", stringify!($event)).into()
}

View File

@ -293,7 +293,7 @@ attr_type!(char);
#[cfg(all(target_arch = "wasm32", feature = "web"))]
#[doc(hidden)]
#[inline]
#[inline(never)]
pub fn attribute_helper(
el: &web_sys::Element,
name: Cow<'static, str>,
@ -316,6 +316,7 @@ pub fn attribute_helper(
}
#[cfg(all(target_arch = "wasm32", feature = "web"))]
#[inline(never)]
pub(crate) fn attribute_expression(
el: &web_sys::Element,
attr_name: &str,

View File

@ -73,6 +73,7 @@ use std::borrow::Cow;
#[cfg(all(target_arch = "wasm32", feature = "web"))]
#[doc(hidden)]
#[inline(never)]
pub fn class_helper(
el: &web_sys::Element,
name: Cow<'static, str>,
@ -98,6 +99,7 @@ pub fn class_helper(
}
#[cfg(all(target_arch = "wasm32", feature = "web"))]
#[inline(never)]
pub(crate) fn class_expression(
class_list: &web_sys::DomTokenList,
class_name: &str,

View File

@ -45,12 +45,14 @@ impl<T: IntoProperty> IntoProperty for (Scope, T) {
macro_rules! prop_type {
($prop_type:ty) => {
impl IntoProperty for $prop_type {
#[inline(always)]
fn into_property(self, _cx: Scope) -> Property {
Property::Value(self.into())
}
}
impl IntoProperty for Option<$prop_type> {
#[inline(always)]
fn into_property(self, _cx: Scope) -> Property {
Property::Value(self.into())
}
@ -82,6 +84,7 @@ prop_type!(bool);
use std::borrow::Cow;
#[cfg(all(target_arch = "wasm32", feature = "web"))]
#[inline(never)]
pub(crate) fn property_helper(
el: &web_sys::Element,
name: Cow<'static, str>,
@ -107,6 +110,7 @@ pub(crate) fn property_helper(
}
#[cfg(all(target_arch = "wasm32", feature = "web"))]
#[inline(never)]
pub(crate) fn property_expression(
el: &web_sys::Element,
prop_name: &str,