Skip to content

Commit 285092a

Browse files
committed
Reenable SSR benchmarks
1 parent c1c74ea commit 285092a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

benchmarks/src/ssr.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use test::Bencher;
44
fn leptos_ssr_bench(b: &mut Bencher) {
55
b.iter(|| {
66
use leptos::*;
7-
7+
HydrationCtx::reset_id();
88
_ = create_scope(create_runtime(), |cx| {
99
#[component]
1010
fn Counter(cx: Scope, initial: i32) -> impl IntoView {
@@ -32,12 +32,11 @@ fn leptos_ssr_bench(b: &mut Bencher) {
3232

3333
assert_eq!(
3434
rendered,
35-
"<main><h1>Welcome to our benchmark page.</h1><p>Here's some introductory text.</p><div><button>-1</button><span>Value: <!>1<template id=\"_3\"></template>!</span><button>+1</button></div><template id=\"_1\"></template><div><button>-1</button><span>Value: <!>2<template id=\"_2\"></template>!</span><button>+1</button></div><template id=\"_0\"></template><div><button>-1</button><span>Value: <!>3<template id=\"_2\"></template>!</span><button>+1</button></div><template id=\"_0\"></template></main>"
36-
);
35+
"<main id=\"_0-1\"><h1 id=\"_0-2\">Welcome to our benchmark page.</h1><p id=\"_0-3\">Here's some introductory text.</p><div id=\"_0-3-1\"><button id=\"_0-3-2\">-1</button><span id=\"_0-3-3\">Value: <!>1<!--hk=_0-3-4-->!</span><button id=\"_0-3-5\">+1</button></div><!--hk=_0-3-0--><div id=\"_0-3-5-1\"><button id=\"_0-3-5-2\">-1</button><span id=\"_0-3-5-3\">Value: <!>2<!--hk=_0-3-5-4-->!</span><button id=\"_0-3-5-5\">+1</button></div><!--hk=_0-3-5-0--><div id=\"_0-3-5-5-1\"><button id=\"_0-3-5-5-2\">-1</button><span id=\"_0-3-5-5-3\">Value: <!>3<!--hk=_0-3-5-5-4-->!</span><button id=\"_0-3-5-5-5\">+1</button></div><!--hk=_0-3-5-5-0--></main>" );
3736
});
3837
});
3938
}
40-
/*
39+
4140
#[bench]
4241
fn tera_ssr_bench(b: &mut Bencher) {
4342
use tera::*;
@@ -194,4 +193,3 @@ fn yew_ssr_bench(b: &mut Bencher) {
194193
});
195194
});
196195
}
197-
*/

benchmarks/src/todomvc/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn yew_todomvc_ssr(b: &mut Bencher) {
5555
});
5656
});
5757
}
58-
58+
/*
5959
#[bench]
6060
fn leptos_todomvc_ssr_with_1000(b: &mut Bencher) {
6161
b.iter(|| {
@@ -107,3 +107,4 @@ fn yew_todomvc_ssr_with_1000(b: &mut Bencher) {
107107
});
108108
});
109109
}
110+
*/

leptos_dom/src/hydration.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ impl HydrationCtx {
104104
})
105105
}
106106

107+
#[doc(hidden)]
107108
#[cfg(not(all(target_arch = "wasm32", feature = "web")))]
108-
pub(crate) fn reset_id() {
109+
pub fn reset_id() {
109110
ID.with(|id| *id.borrow_mut() = Default::default());
110111
}
111112

0 commit comments

Comments
 (0)