浏览代码

remove wasm bench (#10154)

fakeshadow 1 周之前
父节点
当前提交
4580dcc064

文件差异内容过多而无法显示
+ 233 - 196
frameworks/Rust/xitca-web/Cargo.lock


+ 13 - 23
frameworks/Rust/xitca-web/Cargo.toml

@@ -13,11 +13,6 @@ name = "xitca-web-unrealistic"
 path = "./src/main_unrealistic.rs"
 required-features = ["perf", "pg", "template"]
 
-[[bin]]
-name = "xitca-web-wasm"
-path = "./src/main_wasm.rs"
-required-features = ["web"]
-
 [[bin]]
 name = "xitca-web-orm"
 path = "./src/main_orm.rs"
@@ -70,12 +65,12 @@ xitca-postgres = { version = "0.3", optional = true }
 diesel = { version = "2", features = ["postgres"], optional = true }
 
 # orm async optional
-diesel-async = { version = "0.5", features = ["bb8", "postgres"], optional = true }
-xitca-postgres-diesel = { version = "0.1", optional = true }
+diesel-async = { version = "0.7", features = ["bb8", "postgres"], optional = true }
+xitca-postgres-diesel = { version = "0.2", optional = true }
 futures-util = { version = "0.3", default-features = false, optional = true }
 
 # template optional
-sailfish = { version = "0.9", default-features = false, features = ["perf-inline"], optional = true }
+sailfish = { version = "0.10", default-features = false, features = ["perf-inline"], optional = true }
 
 # io-uring optional
 tokio-uring = { version = "0.5", optional = true }
@@ -83,11 +78,9 @@ tokio-uring = { version = "0.5", optional = true }
 # perf optional
 core_affinity = { version = "0.8.1", optional = true }
 mimalloc = { version = "0.1", default-features = false, optional = true }
-simd-json = { version = "0.14", optional = true }
-simd-json-derive =  { version = "0.15", default-features = false, optional = true }
+simd-json = { version = "0.17", optional = true }
+simd-json-derive =  { version = "0.18", default-features = false, optional = true }
 
-# stuff can not be used or not needed in wasi target
-[target.'cfg(not(target_family = "wasm"))'.dependencies]
 futures-core = { version = "0.3", default-features = false }
 rand = { version = "0.9", features = ["os_rng", "small_rng"], default-features = false }
 tokio = "1.41"
@@ -99,14 +92,11 @@ codegen-units = 1
 panic = "abort"
 
 [patch.crates-io]
-xitca-postgres-diesel = { git = "https://github.com/fakeshadow/xitca-postgres-diesel", rev = "ae93ee9" }
-
-diesel-async = { git = "https://github.com/weiznich/diesel_async", rev = "5b8262b" }
-mio = { git = "https://github.com/fakeshadow/mio", rev = "9bae6012b7ecfc6083350785f71a5e8265358178" }
-
-xitca-codegen = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
-xitca-http = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
-xitca-postgres = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
-xitca-server = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
-xitca-service = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
-xitca-web = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
+xitca-postgres-diesel = { git = "https://github.com/fakeshadow/xitca-postgres-diesel", rev = "8ce4e5b" }
+
+xitca-codegen = { git = "http://github.com/HFQR/xitca-web", rev = "7c22b4a" }
+xitca-http = { git = "http://github.com/HFQR/xitca-web", rev = "7c22b4a" }
+xitca-postgres = { git = "http://github.com/HFQR/xitca-web", rev = "7c22b4a" }
+xitca-server = { git = "http://github.com/HFQR/xitca-web", rev = "7c22b4a" }
+xitca-service = { git = "http://github.com/HFQR/xitca-web", rev = "7c22b4a" }
+xitca-web = { git = "http://github.com/HFQR/xitca-web", rev = "7c22b4a" }

+ 0 - 18
frameworks/Rust/xitca-web/benchmark_config.json

@@ -46,24 +46,6 @@
         "notes": "",
         "versus": ""
       },
-      "wasm": {
-        "json_url": "/json",
-        "plaintext_url": "/plaintext",
-        "port": 8080,
-        "approach": "Realistic",
-        "classification": "Micro",
-        "database": "none",
-        "framework": "xitca-web",
-        "language": "rust",
-        "orm": "raw",
-        "platform": "none",
-        "webserver": "xitca-server",
-        "os": "linux",
-        "database_os": "linux",
-        "display_name": "xitca-web [wasm]",
-        "notes": "",
-        "versus": ""
-      },
       "orm": {
         "json_url": "/json",
         "plaintext_url": "/plaintext",

+ 0 - 10
frameworks/Rust/xitca-web/config.toml

@@ -47,13 +47,3 @@ orm = "Raw"
 platform = "None"
 webserver = "xitca-server"
 versus = ""
-
-[wasm]
-urls.json = "/json"
-urls.plaintext = "/plaintext"
-approach = "Realistic"
-classification = "Micro"
-os = "wasi"
-platform = "wasm"
-webserver = "xitca-server"
-versus = ""

+ 3 - 2
frameworks/Rust/xitca-web/src/db_unrealistic.rs

@@ -72,8 +72,9 @@ impl Client {
         let mut worlds = Vec::with_capacity(len);
 
         while let Some(mut item) = res.try_next().await? {
-            let row = item.try_next().await?.ok_or_else(not_found)?;
-            worlds.push(World::new(row.get(0), row.get(1)));
+            while let Some(row) = item.try_next().await? {
+                worlds.push(World::new(row.get(0), row.get(1)));
+            }
         }
 
         Ok(worlds)

+ 2 - 1
frameworks/Rust/xitca-web/src/db_util.rs

@@ -64,10 +64,11 @@ pub mod pg {
         .into_boxed_str()
     }
 
-    pub fn sort_update_params(params: &[[i32; 2]]) -> impl ExactSizeIterator<Item = i32> {
+    pub fn sort_update_params(params: &[[i32; 2]]) -> impl ExactSizeIterator<Item = i32> + Clone {
         let mut params = params.to_owned();
         params.sort_by(|a, b| a[0].cmp(&b[0]));
 
+        #[derive(Clone)]
         struct ParamIter<I>(I);
 
         impl<I> Iterator for ParamIter<I>

+ 1 - 1
frameworks/Rust/xitca-web/src/main_unrealistic.rs

@@ -41,7 +41,7 @@ fn main() -> io::Result<()> {
 
         tokio::runtime::Builder::new_current_thread()
             .enable_all()
-            .build_local(&Default::default())
+            .build_local(Default::default())
             .unwrap()
             .block_on(async {
                 let socket = tokio::net::TcpSocket::new_v4()?;

+ 0 - 33
frameworks/Rust/xitca-web/src/main_wasm.rs

@@ -1,33 +0,0 @@
-mod ser;
-mod util;
-
-use std::os::wasi::io::FromRawFd;
-
-use xitca_web::{
-    App,
-    handler::{json::Json, text::Text},
-    http::{WebResponse, header::SERVER},
-    route::get,
-};
-
-fn main() -> std::io::Result<()> {
-    let listener = std::env::var("FD_COUNT")
-        .ok()
-        .and_then(|v| v.parse().ok())
-        .map(|fd| unsafe { std::net::TcpListener::from_raw_fd(fd) })
-        .expect("failed to parse FD_COUNT env");
-
-    App::new()
-        .at("/json", get(Json(ser::Message::new())))
-        .at("/plaintext", get(Text("Hello, World!")))
-        .map(header)
-        .serve()
-        .listen(listener)?
-        .run()
-        .wait()
-}
-
-fn header(mut res: WebResponse) -> WebResponse {
-    res.headers_mut().append(SERVER, util::SERVER_HEADER_VALUE);
-    res
-}

+ 10 - 16
frameworks/Rust/xitca-web/src/util.rs

@@ -45,25 +45,19 @@ impl<DB> State<DB> {
     }
 }
 
-#[cfg(not(target_arch = "wasm32"))]
-pub mod non_wasm {
-    use rand::{Rng, SeedableRng, rngs::SmallRng};
+use rand::{Rng, SeedableRng, rngs::SmallRng};
 
-    pub struct Rand(SmallRng);
+pub struct Rand(SmallRng);
 
-    impl Default for Rand {
-        fn default() -> Self {
-            Self(SmallRng::from_os_rng())
-        }
+impl Default for Rand {
+    fn default() -> Self {
+        Self(SmallRng::from_os_rng())
     }
+}
 
-    impl Rand {
-        #[inline]
-        pub fn gen_id(&mut self) -> i32 {
-            self.0.random_range(1..=10000)
-        }
+impl Rand {
+    #[inline]
+    pub fn gen_id(&mut self) -> i32 {
+        self.0.random_range(1..=10000)
     }
 }
-
-#[cfg(not(target_arch = "wasm32"))]
-pub use non_wasm::*;

+ 1 - 1
frameworks/Rust/xitca-web/xitca-web-orm.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.85
+FROM rust:1.90
 
 ADD ./ /xitca-web
 WORKDIR /xitca-web

+ 1 - 1
frameworks/Rust/xitca-web/xitca-web-sync.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.85
+FROM rust:1.90
 
 ADD ./ /xitca-web
 WORKDIR /xitca-web

+ 1 - 1
frameworks/Rust/xitca-web/xitca-web-unrealistic.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.85
+FROM rust:1.90
 
 ADD ./ /xitca-web
 WORKDIR /xitca-web

+ 0 - 35
frameworks/Rust/xitca-web/xitca-web-wasm.dockerfile

@@ -1,35 +0,0 @@
-ARG WASMTIME_VERSION=15.0.0
-ARG WASM_TARGET=wasm32-wasip1-threads
-
-FROM rust:1.85 AS compile
-
-ARG WASMTIME_VERSION
-ARG WASM_TARGET
-
-WORKDIR /tmp
-COPY / ./
-RUN curl -LSs "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-$(uname -m)-linux.tar.xz" | \
-tar --strip-components=1 -Jx && \
-rustup default nightly && \
-rustup target add ${WASM_TARGET} && \
-cargo build --bin xitca-web-wasm --features web --release --target ${WASM_TARGET}
-
-
-FROM ubuntu:22.04
-
-ARG WASM_TARGET
-ARG BENCHMARK_ENV
-ARG TFB_TEST_DATABASE
-ARG TFB_TEST_NAME
-
-COPY --from=compile \
-/tmp/target/${WASM_TARGET}/release/xitca-web-wasm.wasm \
-/tmp/wasmtime \
-/opt/xitca-web-wasm/
-EXPOSE 8080
-
-CMD /opt/xitca-web-wasm/wasmtime run \
---wasm all-proposals=y \
---wasi threads=y,tcplisten=0.0.0.0:8080 \
---env FD_COUNT=3 \
-/opt/xitca-web-wasm/xitca-web-wasm.wasm

+ 1 - 1
frameworks/Rust/xitca-web/xitca-web.dockerfile

@@ -1,4 +1,4 @@
-FROM rust:1.85
+FROM rust:1.90
 
 ADD ./ /xitca-web
 WORKDIR /xitca-web

部分文件因为文件数量过多而无法显示