Skip to content

Commit 29046e4

Browse files
committed
[xitca-web] enable more optimization
1 parent 80c46e9 commit 29046e4

16 files changed

+112
-165
lines changed

frameworks/Rust/xitca-web/Cargo.lock

Lines changed: 19 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/Rust/xitca-web/Cargo.toml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ path = "./src/main.rs"
99
required-features = ["io-uring", "pg", "router", "template"]
1010

1111
[[bin]]
12-
name = "xitca-web-unrealistic"
13-
path = "./src/main_unrealistic.rs"
14-
required-features = ["perf", "pg", "template"]
12+
name = "xitca-web-barebone"
13+
path = "./src/main_barebone.rs"
14+
required-features = ["perf", "perf-json", "pg", "template"]
1515

1616
[[bin]]
1717
name = "xitca-web-diesel"
1818
path = "./src/main_orm.rs"
19-
required-features = ["diesel", "template", "web-codegen"]
19+
required-features = ["diesel", "perf", "template", "web-codegen"]
2020

2121
[[bin]]
2222
name = "xitca-web-toasty"
2323
path = "./src/main_orm.rs"
24-
required-features = ["toasty", "template", "web-codegen"]
24+
required-features = ["perf", "template", "toasty", "web-codegen"]
2525

2626
[features]
2727
# pg client optional
@@ -41,7 +41,8 @@ template = ["dep:sailfish"]
4141
# io-uring optional
4242
io-uring = ["dep:tokio-uring", "xitca-http/io-uring", "xitca-server/io-uring"]
4343
# unrealistic performance optimization
44-
perf = ["dep:core_affinity", "dep:mimalloc", "tokio/parking_lot", "simd-json", "simd-json-derive"]
44+
perf = ["dep:core_affinity", "dep:mimalloc", "tokio/parking_lot"]
45+
perf-json = ["simd-json", "simd-json-derive"]
4546

4647
[dependencies]
4748
xitca-http = "0.7"
@@ -63,7 +64,7 @@ xitca-postgres = { version = "0.3", optional = true }
6364

6465
# diesel orm optional
6566
diesel = { version = "2", features = ["postgres"], optional = true }
66-
diesel-async = { version = "0.7", features = ["bb8", "postgres"], optional = true }
67+
diesel-async = { version = "0.7", features = ["postgres"], optional = true }
6768
xitca-postgres-diesel = { version = "0.2", default-features = false, optional = true }
6869
futures-util = { version = "0.3", default-features = false, optional = true }
6970

@@ -85,7 +86,7 @@ simd-json-derive = { version = "0.18", default-features = false, optional = tru
8586

8687
futures-core = { version = "0.3", default-features = false }
8788
rand = { version = "0.9", features = ["os_rng", "small_rng"], default-features = false }
88-
tokio = "1.41"
89+
tokio = "1.48"
8990

9091
[profile.release]
9192
lto = true
@@ -94,17 +95,17 @@ codegen-units = 1
9495
panic = "abort"
9596

9697
[patch.crates-io]
97-
xitca-postgres-diesel = { git = "https://github.com/fakeshadow/xitca-postgres-diesel", rev = "7671975" }
98+
xitca-postgres-diesel = { git = "https://github.com/fakeshadow/xitca-postgres-diesel", rev = "ffd222a" }
9899
xitca-postgres-toasty = { git = "https://github.com/fakeshadow/xitca-postgres-toasty", rev = "04bedb8" }
99100

100101
# personal fork for efficient toasty engine fine tuned with pipelined xitca-postgres client
101102
toasty = { git = "https://github.com/fakeshadow/toasty", branch = "engine" }
102103
toasty-core = { git = "https://github.com/fakeshadow/toasty", branch = "engine" }
103104
toasty-sql = { git = "https://github.com/fakeshadow/toasty", branch = "engine" }
104105

105-
xitca-codegen = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
106-
xitca-http = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
107-
xitca-postgres = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
108-
xitca-server = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
109-
xitca-service = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
110-
xitca-web = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
106+
xitca-codegen = { git = "http://github.com/HFQR/xitca-web", rev = "91c6c31" }
107+
xitca-http = { git = "http://github.com/HFQR/xitca-web", rev = "91c6c31" }
108+
xitca-postgres = { git = "http://github.com/HFQR/xitca-web", rev = "91c6c31" }
109+
xitca-server = { git = "http://github.com/HFQR/xitca-web", rev = "91c6c31" }
110+
xitca-service = { git = "http://github.com/HFQR/xitca-web", rev = "91c6c31" }
111+
xitca-web = { git = "http://github.com/HFQR/xitca-web", rev = "91c6c31" }

frameworks/Rust/xitca-web/benchmark_config.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
"notes": "",
2525
"versus": ""
2626
},
27-
"unrealistic": {
27+
"barebone": {
2828
"json_url": "/json",
2929
"plaintext_url": "/plaintext",
3030
"db_url": "/db",
3131
"fortune_url": "/fortunes",
3232
"query_url": "/queries?q=",
3333
"update_url": "/updates?q=",
3434
"port": 8080,
35-
"approach": "Stripped",
35+
"approach": "Realistic",
3636
"classification": "Platform",
3737
"database": "Postgres",
3838
"framework": "xitca-web",
@@ -42,7 +42,7 @@
4242
"webserver": "xitca-server",
4343
"os": "Linux",
4444
"database_os": "Linux",
45-
"display_name": "xitca-web [unrealistic]",
45+
"display_name": "xitca-web [barebone]",
4646
"notes": "",
4747
"versus": ""
4848
},

frameworks/Rust/xitca-web/src/db.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ mod db_util;
33

44
use core::cell::RefCell;
55

6+
use xitca_io::bytes::BytesMut;
67
use xitca_postgres::{Execute, iter::AsyncLendingIterator, pipeline::Pipeline, pool::Pool};
78

89
use super::{
910
ser::{Fortune, Fortunes, World},
10-
util::{DB_URL, HandleResult},
11+
util::{DB_URL, HandleResult, Rand},
1112
};
1213

13-
use db_util::{FORTUNE_STMT, Shared, UPDATE_STMT, WORLD_STMT, not_found};
14+
use db_util::{FORTUNE_STMT, UPDATE_STMT, WORLD_STMT, not_found};
1415

1516
pub struct Client {
1617
pool: Pool,
17-
shared: RefCell<Shared>,
18+
shared: RefCell<(Rand, BytesMut)>,
1819
}
1920

2021
pub async fn create() -> HandleResult<Client> {

0 commit comments

Comments
 (0)