Skip to content

Commit

Permalink
Jemalloc only works on *nix (#3474)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile authored Oct 20, 2023
1 parent 04909dd commit c5e63d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/ssr_router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ tower-http = { version = "0.3", features = ["fs"] }
env_logger = "0.10"
clap = { version = "4", features = ["derive"] }
hyper = { version = "0.14", features = ["server", "http1"] }

[target.'cfg(unix)'.dependencies]
jemallocator = "0.5"

[features]
Expand Down
1 change: 1 addition & 0 deletions examples/ssr_router/src/bin/ssr_router_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use tower_http::services::ServeDir;
use yew::platform::Runtime;

// We use jemalloc as it produces better performance.
#[cfg(unix)]
#[global_allocator]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;

Expand Down
4 changes: 3 additions & 1 deletion tools/benchmark-ssr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ edition = "2021"
yew = { path = "../../packages/yew", features = ["ssr"] }
function_router = { path = "../../examples/function_router" }
tokio = { version = "1.32", features = ["full"] }
jemallocator = "0.5.4"
average = "0.14.1"
tabled = "0.14.0"
indicatif = "0.17.7"
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.107"
clap = { version = "4", features = ["derive"] }

[target.'cfg(unix)'.dependencies]
jemallocator = "0.5.4"
1 change: 1 addition & 0 deletions tools/benchmark-ssr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use tokio::task::{spawn_local, LocalSet};
use yew::platform::time::sleep;
use yew::prelude::*;

#[cfg(unix)]
#[global_allocator]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;

Expand Down

0 comments on commit c5e63d8

Please sign in to comment.