fix cargo check all features except the router

This commit is contained in:
Evan Almloff committed 2024-02-16 16:22:13 -06:00
1 parent 2952578a2e
commit 14b4af4bbc
7 files changed
+105 -93

No files matched your search

+68 -63
View File
@@ -11,7 +11,45 @@ use dioxus_ssr::Renderer;
pub fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("build 1000 routes", |b| {
let mut renderer = IncrementalRenderer::builder(DefaultRenderer {
let mut renderer = IncrementalRenderer::builder()
.static_dir("./static")
.invalidate_after(Duration::from_secs(10))
.build();
let wrapper = DefaultRenderer {
before_body: r#"<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Dioxus Application</title>
</head>
<body>"#
.to_string(),
after_body: r#"</body>
</html>"#
.to_string(),
};
b.iter(|| {
tokio::runtime::Runtime::new().unwrap().block_on(async {
for id in 0..1000 {
render_route(
&mut renderer,
Route::Post { id },
&mut tokio::io::sink(),
|_| Box::pin(async move {}),
&wrapper,
)
.await
.unwrap();
}
})
})
});
c.bench_function("build 1000 routes no memory cache", |b| {
let wrapper = DefaultRenderer {
before_body: r#"<!DOCTYPE html>
<html lang="en">
<head>
@@ -25,56 +63,22 @@ pub fn criterion_benchmark(c: &mut Criterion) {
after_body: r#"</body>
</html>"#
.to_string(),
})
.static_dir("./static")
.invalidate_after(Duration::from_secs(10))
.build();
b.iter(|| {
tokio::runtime::Runtime::new().unwrap().block_on(async {
for id in 0..1000 {
render_route(
&mut renderer,
Route::Post { id },
&mut tokio::io::sink(),
|_| {},
)
.await
.unwrap();
}
})
})
});
c.bench_function("build 1000 routes no memory cache", |b| {
};
b.to_async(tokio::runtime::Runtime::new().unwrap())
.iter(|| async {
let mut renderer = IncrementalRenderer::builder(DefaultRenderer {
before_body: r#"<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Dioxus Application</title>
</head>
<body>"#
.to_string(),
after_body: r#"</body>
</html>"#
.to_string(),
})
.static_dir("./static")
.memory_cache_limit(0)
.invalidate_after(Duration::from_secs(10))
.build();
let mut renderer = IncrementalRenderer::builder()
.static_dir("./static")
.memory_cache_limit(0)
.invalidate_after(Duration::from_secs(10))
.build();
for id in 0..1000 {
render_route(
&mut renderer,
Route::Post { id },
&mut tokio::io::sink(),
|_| {},
|_| Box::pin(async move {}),
&wrapper,
)
.await
.unwrap();
@@ -91,7 +95,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
RenderPathProps::builder().path(Route::Post { id }).build(),
);
vdom.rebuild();
vdom.rebuild_in_place();
struct Ignore;
@@ -106,27 +110,28 @@ pub fn criterion_benchmark(c: &mut Criterion) {
})
});
c.bench_function("cache static", |b| {
let wrapper = DefaultRenderer {
before_body: r#"<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Dioxus Application</title>
</head>
<body>"#
.to_string(),
after_body: r#"</body>
</html>"#
.to_string(),
};
b.to_async(tokio::runtime::Runtime::new().unwrap())
.iter(|| async {
let mut renderer = IncrementalRenderer::builder(DefaultRenderer {
before_body: r#"<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Dioxus Application</title>
</head>
<body>"#
.to_string(),
after_body: r#"</body>
</html>"#
.to_string(),
})
.static_dir("./static")
.build();
let mut renderer = IncrementalRenderer::builder()
.static_dir("./static")
.build();
pre_cache_static_routes::<Route, _>(&mut renderer)
pre_cache_static_routes::<Route, _>(&mut renderer, &wrapper)
.await
.unwrap();
})
@@ -148,7 +153,7 @@ fn Blog() -> Element {
#[component]
fn Post(id: usize) -> Element {
rsx! {
for _ in 0..*id {
for _ in 0..id {
div {
"PostId: {id}"
}
-1
View File
@@ -135,7 +135,6 @@ where
MemoryHistory::<R>::with_initial_path(
dioxus_fullstack::prelude::server_context()
.request_parts()
.unwrap()
.uri
.to_string()
.parse()