Skip to content

Commit 9e58d22

Browse files
authored
[ntex] replace async-std with compio runtime (#9222)
* ntex: replace async-std with compio * wip * wip
1 parent 3db2b8d commit 9e58d22

File tree

8 files changed

+30
-24
lines changed

8 files changed

+30
-24
lines changed

frameworks/Rust/ntex/Cargo.toml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "ntex"
2+
name = "ntex-bench"
33
version = "2.0.0"
44
edition = "2018"
55

@@ -8,23 +8,23 @@ name = "ntex"
88
path = "src/main.rs"
99

1010
[[bin]]
11-
name = "ntex-astd"
11+
name = "ntex-compio"
1212
path = "src/main.rs"
1313

1414
[[bin]]
1515
name = "ntex-db"
1616
path = "src/main_db.rs"
1717

1818
[[bin]]
19-
name = "ntex-db-astd"
19+
name = "ntex-db-compio"
2020
path = "src/main_db.rs"
2121

2222
[[bin]]
2323
name = "ntex-plt"
2424
path = "src/main_plt.rs"
2525

2626
[[bin]]
27-
name = "ntex-plt-astd"
27+
name = "ntex-plt-compio"
2828
path = "src/main_plt.rs"
2929

3030
[features]
@@ -33,11 +33,11 @@ default = []
3333
# tokio runtime
3434
tokio = ["ntex/tokio"]
3535

36-
# async-std runtime
37-
async-std = ["ntex/async-std"]
36+
# compio runtime
37+
compio = ["ntex/compio"]
3838

3939
[dependencies]
40-
ntex = "=2.1.0"
40+
ntex = "2.4"
4141
ntex-bytes = { version = "0.1.21", features=["simd"] }
4242
mimalloc = { version = "0.1.25", default-features = false }
4343
snmalloc-rs = { version = "0.3.3", features = ["native-cpu"] }
@@ -63,3 +63,10 @@ lto = "thin"
6363
debug = false
6464
incremental = false
6565
overflow-checks = false
66+
67+
[patch.crates-io]
68+
ntex = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
69+
ntex-io = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
70+
ntex-rt = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
71+
ntex-net = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }
72+
ntex-compio = { git = "https://github.com/ntex-rs/ntex.git", branch = "compio" }

frameworks/Rust/ntex/benchmark_config.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"notes": "",
2020
"versus": ""
2121
},
22-
"astd": {
22+
"compio": {
2323
"json_url": "/json",
2424
"plaintext_url": "/plaintext",
2525
"port": 8080,
@@ -33,7 +33,7 @@
3333
"webserver": "ntex",
3434
"os": "Linux",
3535
"database_os": "Linux",
36-
"display_name": "ntex [async-std]",
36+
"display_name": "ntex [compio]",
3737
"notes": "",
3838
"versus": ""
3939
},
@@ -57,7 +57,7 @@
5757
"notes": "",
5858
"versus": ""
5959
},
60-
"db-astd": {
60+
"db-compio": {
6161
"fortune_url": "/fortunes",
6262
"db_url": "/db",
6363
"query_url": "/query?q=",
@@ -73,7 +73,7 @@
7373
"webserver": "ntex",
7474
"os": "Linux",
7575
"database_os": "Linux",
76-
"display_name": "ntex [async-std,db]",
76+
"display_name": "ntex [compio,db]",
7777
"notes": "",
7878
"versus": ""
7979
},
@@ -95,7 +95,7 @@
9595
"notes": "",
9696
"versus": ""
9797
},
98-
"plt-astd": {
98+
"plt-compio": {
9999
"json_url": "/json",
100100
"plaintext_url": "/plaintext",
101101
"port": 8080,
@@ -109,7 +109,7 @@
109109
"webserver": "ntex",
110110
"os": "Linux",
111111
"database_os": "Linux",
112-
"display_name": "ntex [async-std,platform]",
112+
"display_name": "ntex [compio,platform]",
113113
"notes": "",
114114
"versus": ""
115115
}

frameworks/Rust/ntex/config.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ platform = "None"
1414
webserver = "ntex"
1515
versus = ""
1616

17-
[astd]
17+
[compio]
1818
urls.plaintext = "/plaintext"
1919
urls.json = "/json"
2020
approach = "Realistic"
@@ -42,7 +42,7 @@ platform = "None"
4242
webserver = "ntex"
4343
versus = ""
4444

45-
[db-astd]
45+
[db-compio]
4646
urls.db = "/db"
4747
urls.query = "/query?q="
4848
urls.update = "/update?q="
@@ -70,7 +70,7 @@ platform = "None"
7070
webserver = "ntex"
7171
versus = ""
7272

73-
[plt-astd]
73+
[plt-compio]
7474
urls.plaintext = "/plaintext"
7575
urls.json = "/json"
7676
approach = "Realistic"

frameworks/Rust/ntex/ntex-astd.dockerfile renamed to frameworks/Rust/ntex/ntex-compio.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ ADD ./ /ntex
99
WORKDIR /ntex
1010

1111
RUN cargo clean
12-
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="async-std"
12+
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="compio"
1313

1414
EXPOSE 8080
1515

16-
CMD ./target/release/ntex-astd
16+
CMD ./target/release/ntex-compio

frameworks/Rust/ntex/ntex-db-astd.dockerfile renamed to frameworks/Rust/ntex/ntex-db-compio.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ ADD ./ /ntex
99
WORKDIR /ntex
1010

1111
RUN cargo clean
12-
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="async-std"
12+
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="compio"
1313

1414
EXPOSE 8080
1515

16-
CMD ./target/release/ntex-db-astd
16+
CMD ./target/release/ntex-db-compio

frameworks/Rust/ntex/ntex-plt-astd.dockerfile renamed to frameworks/Rust/ntex/ntex-plt-compio.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ ADD ./ /ntex
99
WORKDIR /ntex
1010

1111
RUN cargo clean
12-
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="async-std"
12+
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --features="compio"
1313

1414
EXPOSE 8080
1515

16-
CMD ./target/release/ntex-plt-astd
16+
CMD ./target/release/ntex-plt-compio

frameworks/Rust/ntex/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#[global_allocator]
22
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
3-
// static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
43

54
use ntex::http::header::{CONTENT_TYPE, SERVER};
65
use ntex::{http, time::Seconds, util::BytesMut, util::PoolId, web};

frameworks/Rust/ntex/src/main_plt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[global_allocator]
2-
static GLOBAL: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
2+
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
33

44
use std::{future::Future, io, pin::Pin, task::Context, task::Poll};
55

0 commit comments

Comments
 (0)