Browse Source

[xitca-web] enable more optimization (#10360)

* [xitca-web] enable more optimization

* remove all usage of explict pipeline

* dep update

* update toasty to support cow<str>

* dep dedup

* dep update

* improve compile time

* improve compile time
fakeshadow 1 week ago
parent
commit
996962fab4

+ 187 - 280
frameworks/Rust/xitca-web/Cargo.lock

@@ -2,6 +2,19 @@
 # It is not intended for manual editing.
 version = 4
 
+[[package]]
+name = "ahash"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
+dependencies = [
+ "cfg-if",
+ "getrandom 0.3.4",
+ "once_cell",
+ "version_check",
+ "zerocopy",
+]
+
 [[package]]
 name = "aho-corasick"
 version = "1.1.4"
@@ -11,12 +24,6 @@ dependencies = [
  "memchr",
 ]
 
-[[package]]
-name = "allocator-api2"
-version = "0.2.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
-
 [[package]]
 name = "anyhow"
 version = "1.0.100"
@@ -77,18 +84,6 @@ version = "0.22.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
 
-[[package]]
-name = "bb8"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "457d7ed3f888dfd2c7af56d4975cade43c622f74bdcddfed6d4352f57acc6310"
-dependencies = [
- "futures-util",
- "parking_lot",
- "portable-atomic",
- "tokio",
-]
-
 [[package]]
 name = "bit-set"
 version = "0.8.0"
@@ -104,12 +99,6 @@ version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
 
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
 [[package]]
 name = "bitflags"
 version = "2.10.0"
@@ -151,9 +140,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
 
 [[package]]
 name = "cc"
-version = "1.2.48"
+version = "1.2.49"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a"
+checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215"
 dependencies = [
  "find-msvc-tools",
  "shlex",
@@ -236,7 +225,7 @@ version = "2.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0c415189028b232660655e4893e8bc25ca7aee8e96888db66d9edb400535456a"
 dependencies = [
- "bitflags 2.10.0",
+ "bitflags",
  "byteorder",
  "diesel_derives",
  "downcast-rs",
@@ -250,13 +239,10 @@ version = "0.7.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "13096fb8dae53f2d411c4b523bec85f45552ed3044a2ab4d85fb2092d9cb4f34"
 dependencies = [
- "bb8",
  "diesel",
  "futures-core",
  "futures-util",
  "scoped-futures",
- "tokio",
- "tokio-postgres",
 ]
 
 [[package]]
@@ -342,19 +328,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
 
 [[package]]
-name = "find-msvc-tools"
-version = "0.1.5"
+name = "faststr"
+version = "0.2.32"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
+checksum = "baec6a0289d7f1fe5665586ef7340af82e3037207bef60f5785e57569776f0c8"
+dependencies = [
+ "bytes",
+ "rkyv",
+ "serde",
+ "simdutf8",
+]
 
 [[package]]
-name = "float-cmp"
-version = "0.10.0"
+name = "find-msvc-tools"
+version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8"
-dependencies = [
- "num-traits",
-]
+checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
 
 [[package]]
 name = "fnv"
@@ -362,12 +351,6 @@ version = "1.0.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
 
-[[package]]
-name = "foldhash"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
-
 [[package]]
 name = "form_urlencoded"
 version = "1.2.2"
@@ -377,16 +360,6 @@ dependencies = [
  "percent-encoding",
 ]
 
-[[package]]
-name = "futures-channel"
-version = "0.3.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
-dependencies = [
- "futures-core",
- "futures-sink",
-]
-
 [[package]]
 name = "futures-core"
 version = "0.3.31"
@@ -416,7 +389,6 @@ dependencies = [
  "futures-task",
  "pin-project-lite",
  "pin-utils",
- "slab",
 ]
 
 [[package]]
@@ -453,25 +425,16 @@ dependencies = [
 ]
 
 [[package]]
-name = "halfbrown"
-version = "0.4.0"
+name = "hashbrown"
+version = "0.15.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c7ed2f2edad8a14c8186b847909a41fbb9c3eafa44f88bd891114ed5019da09"
-dependencies = [
- "hashbrown",
- "serde",
-]
+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
 
 [[package]]
 name = "hashbrown"
 version = "0.16.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
-dependencies = [
- "allocator-api2",
- "equivalent",
- "foldhash",
-]
 
 [[package]]
 name = "heck"
@@ -637,16 +600,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
 dependencies = [
  "equivalent",
- "hashbrown",
+ "hashbrown 0.16.1",
 ]
 
 [[package]]
 name = "io-uring"
-version = "0.6.4"
+version = "0.7.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "595a0399f411a508feb2ec1e970a4a30c249351e30208960d58298de8660b0e5"
+checksum = "fdd7bddefd0a8833b88a4b68f90dae22c7450d11b354198baee3874fd811b344"
 dependencies = [
- "bitflags 1.3.2",
+ "bitflags",
+ "cfg-if",
  "libc",
 ]
 
@@ -680,9 +644,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
 
 [[package]]
 name = "libc"
-version = "0.2.177"
+version = "0.2.178"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
+checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
 
 [[package]]
 name = "libmimalloc-sys"
@@ -694,17 +658,6 @@ dependencies = [
  "libc",
 ]
 
-[[package]]
-name = "libredox"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
-dependencies = [
- "bitflags 2.10.0",
- "libc",
- "redox_syscall",
-]
-
 [[package]]
 name = "litemap"
 version = "0.8.1"
@@ -720,12 +673,6 @@ dependencies = [
  "scopeguard",
 ]
 
-[[package]]
-name = "log"
-version = "0.4.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
-
 [[package]]
 name = "md-5"
 version = "0.10.6"
@@ -753,15 +700,35 @@ dependencies = [
 
 [[package]]
 name = "mio"
-version = "1.1.0"
+version = "1.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
+checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
 dependencies = [
  "libc",
  "wasi",
  "windows-sys 0.61.2",
 ]
 
+[[package]]
+name = "munge"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e17401f259eba956ca16491461b6e8f72913a0a114e39736ce404410f915a0c"
+dependencies = [
+ "munge_macro",
+]
+
+[[package]]
+name = "munge_macro"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4568f25ccbd45ab5d5603dc34318c1ec56b117531781260002151b8530a9f931"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
 [[package]]
 name = "num-traits"
 version = "0.2.19"
@@ -816,25 +783,6 @@ version = "2.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
 
-[[package]]
-name = "phf"
-version = "0.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
-dependencies = [
- "phf_shared",
- "serde",
-]
-
-[[package]]
-name = "phf_shared"
-version = "0.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266"
-dependencies = [
- "siphasher",
-]
-
 [[package]]
 name = "pin-project-lite"
 version = "0.2.16"
@@ -863,12 +811,6 @@ dependencies = [
  "regex",
 ]
 
-[[package]]
-name = "portable-atomic"
-version = "1.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
-
 [[package]]
 name = "postgres-protocol"
 version = "0.6.9"
@@ -936,6 +878,26 @@ dependencies = [
  "unicode-ident",
 ]
 
+[[package]]
+name = "ptr_meta"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b9a0cf95a1196af61d4f1cbdab967179516d9a4a4312af1f31948f8f6224a79"
+dependencies = [
+ "ptr_meta_derive",
+]
+
+[[package]]
+name = "ptr_meta_derive"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7347867d0a7e1208d93b46767be83e2b8f978c3dad35f775ac8d8847551d6fe1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
 [[package]]
 name = "quote"
 version = "1.0.42"
@@ -951,6 +913,15 @@ version = "5.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
 
+[[package]]
+name = "rancor"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a063ea72381527c2a0561da9c80000ef822bdd7c3241b1cc1b12100e3df081ee"
+dependencies = [
+ "ptr_meta",
+]
+
 [[package]]
 name = "rand"
 version = "0.8.5"
@@ -1016,7 +987,7 @@ version = "0.5.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
 dependencies = [
- "bitflags 2.10.0",
+ "bitflags",
 ]
 
 [[package]]
@@ -1068,6 +1039,41 @@ version = "0.8.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
 
+[[package]]
+name = "rend"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cadadef317c2f20755a64d7fdc48f9e7178ee6b0e1f7fce33fa60f1d68a276e6"
+
+[[package]]
+name = "rkyv"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35a640b26f007713818e9a9b65d34da1cf58538207b052916a83d80e43f3ffa4"
+dependencies = [
+ "bytes",
+ "hashbrown 0.15.5",
+ "indexmap",
+ "munge",
+ "ptr_meta",
+ "rancor",
+ "rend",
+ "rkyv_derive",
+ "tinyvec",
+ "uuid",
+]
+
+[[package]]
+name = "rkyv_derive"
+version = "0.8.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd83f5f173ff41e00337d97f6572e416d022ef8a19f371817259ae960324c482"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
 [[package]]
 name = "rustversion"
 version = "1.0.22"
@@ -1082,9 +1088,9 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
 
 [[package]]
 name = "sailfish"
-version = "0.10.0"
+version = "0.10.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40efbac4e16ca6b1a5706348ada4d8b67d7b417ac2001aa6c4ae092511bb1763"
+checksum = "51bd7299cb39e7e0d9350a2f4ec0c0f2a98de9608ada54983c3c30f4d55051b8"
 dependencies = [
  "itoap",
  "ryu",
@@ -1187,59 +1193,12 @@ dependencies = [
  "libc",
 ]
 
-[[package]]
-name = "simd-json"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4255126f310d2ba20048db6321c81ab376f6a6735608bf11f0785c41f01f64e3"
-dependencies = [
- "halfbrown",
- "ref-cast",
- "serde",
- "serde_json",
- "simdutf8",
- "value-trait",
-]
-
-[[package]]
-name = "simd-json-derive"
-version = "0.18.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8582b571efbbb6d89a2d3807c283a42de7e2a5d92fa09c6498ac17abb3f58220"
-dependencies = [
- "itoa",
- "ryu",
- "simd-json",
- "simd-json-derive-int",
- "thiserror",
- "value-trait",
-]
-
-[[package]]
-name = "simd-json-derive-int"
-version = "0.18.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e60b40db276e0d588874b1317a1603e0795ef38889e09111d841a9845623efd0"
-dependencies = [
- "proc-macro2",
- "quote",
- "simd-json",
- "syn",
- "thiserror",
-]
-
 [[package]]
 name = "simdutf8"
 version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
 
-[[package]]
-name = "siphasher"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
-
 [[package]]
 name = "slab"
 version = "0.4.11"
@@ -1254,22 +1213,51 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
 
 [[package]]
 name = "socket2"
-version = "0.4.10"
+version = "0.6.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
+checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881"
 dependencies = [
  "libc",
- "winapi",
+ "windows-sys 0.60.2",
 ]
 
 [[package]]
-name = "socket2"
-version = "0.6.1"
+name = "sonic-number"
+version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881"
+checksum = "a8a74044c092f4f43ca7a6cfd62854cf9fb5ac8502b131347c990bf22bef1dfe"
 dependencies = [
- "libc",
- "windows-sys 0.60.2",
+ "cfg-if",
+]
+
+[[package]]
+name = "sonic-rs"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4425ea8d66ec950e0a8f2ef52c766cc3d68d661d9a0845c353c40833179fd866"
+dependencies = [
+ "ahash",
+ "bumpalo",
+ "bytes",
+ "cfg-if",
+ "faststr",
+ "itoa",
+ "ref-cast",
+ "ryu",
+ "serde",
+ "simdutf8",
+ "sonic-number",
+ "sonic-simd",
+ "thiserror",
+]
+
+[[package]]
+name = "sonic-simd"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5707edbfb34a40c9f2a55fa09a49101d9fec4e0cc171ce386086bd9616f34257"
+dependencies = [
+ "cfg-if",
 ]
 
 [[package]]
@@ -1281,7 +1269,7 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
 [[package]]
 name = "std-util"
 version = "0.1.0"
-source = "git+https://github.com/fakeshadow/toasty?branch=engine#adff354a113ae85dd26a5fd8cecc2807fa12d5bf"
+source = "git+https://github.com/fakeshadow/toasty?branch=engine#2132c89dfd7a4698cdaaa85888c016b97c01471a"
 dependencies = [
  "heck",
  "pluralizer",
@@ -1381,7 +1369,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
 [[package]]
 name = "toasty"
 version = "0.1.0"
-source = "git+https://github.com/fakeshadow/toasty?branch=engine#adff354a113ae85dd26a5fd8cecc2807fa12d5bf"
+source = "git+https://github.com/fakeshadow/toasty?branch=engine#2132c89dfd7a4698cdaaa85888c016b97c01471a"
 dependencies = [
  "anyhow",
  "async-stream",
@@ -1399,7 +1387,7 @@ dependencies = [
 [[package]]
 name = "toasty-codegen"
 version = "0.1.0"
-source = "git+https://github.com/fakeshadow/toasty?branch=engine#adff354a113ae85dd26a5fd8cecc2807fa12d5bf"
+source = "git+https://github.com/fakeshadow/toasty?branch=engine#2132c89dfd7a4698cdaaa85888c016b97c01471a"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1410,7 +1398,7 @@ dependencies = [
 [[package]]
 name = "toasty-core"
 version = "0.1.0"
-source = "git+https://github.com/fakeshadow/toasty?branch=engine#adff354a113ae85dd26a5fd8cecc2807fa12d5bf"
+source = "git+https://github.com/fakeshadow/toasty?branch=engine#2132c89dfd7a4698cdaaa85888c016b97c01471a"
 dependencies = [
  "anyhow",
  "async-trait",
@@ -1424,7 +1412,7 @@ dependencies = [
 [[package]]
 name = "toasty-macros"
 version = "0.1.0"
-source = "git+https://github.com/fakeshadow/toasty?branch=engine#adff354a113ae85dd26a5fd8cecc2807fa12d5bf"
+source = "git+https://github.com/fakeshadow/toasty?branch=engine#2132c89dfd7a4698cdaaa85888c016b97c01471a"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1436,7 +1424,7 @@ dependencies = [
 [[package]]
 name = "toasty-sql"
 version = "0.1.0"
-source = "git+https://github.com/fakeshadow/toasty?branch=engine#adff354a113ae85dd26a5fd8cecc2807fa12d5bf"
+source = "git+https://github.com/fakeshadow/toasty?branch=engine#2132c89dfd7a4698cdaaa85888c016b97c01471a"
 dependencies = [
  "anyhow",
  "toasty-core",
@@ -1454,7 +1442,7 @@ dependencies = [
  "parking_lot",
  "pin-project-lite",
  "signal-hook-registry",
- "socket2 0.6.1",
+ "socket2",
  "tokio-macros",
  "windows-sys 0.61.2",
 ]
@@ -1470,32 +1458,6 @@ dependencies = [
  "syn",
 ]
 
-[[package]]
-name = "tokio-postgres"
-version = "0.7.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b40d66d9b2cfe04b628173409368e58247e8eddbbd3b0e6c6ba1d09f20f6c9e"
-dependencies = [
- "async-trait",
- "byteorder",
- "bytes",
- "fallible-iterator",
- "futures-channel",
- "futures-util",
- "log",
- "parking_lot",
- "percent-encoding",
- "phf",
- "pin-project-lite",
- "postgres-protocol",
- "postgres-types",
- "rand 0.9.2",
- "socket2 0.6.1",
- "tokio",
- "tokio-util",
- "whoami",
-]
-
 [[package]]
 name = "tokio-stream"
 version = "0.1.17"
@@ -1509,29 +1471,14 @@ dependencies = [
 
 [[package]]
 name = "tokio-uring"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "748482e3e13584a34664a710168ad5068e8cb1d968aa4ffa887e83ca6dd27967"
+version = "0.5.1"
+source = "git+http://github.com/fakeshadow/tokio-uring?rev=97d9a98#97d9a988704b5466809633b3ca6ba07acba3f38b"
 dependencies = [
  "bytes",
- "futures-util",
  "io-uring",
  "libc",
  "slab",
- "socket2 0.4.10",
- "tokio",
-]
-
-[[package]]
-name = "tokio-util"
-version = "0.7.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594"
-dependencies = [
- "bytes",
- "futures-core",
- "futures-sink",
- "pin-project-lite",
+ "socket2",
  "tokio",
 ]
 
@@ -1604,9 +1551,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
 
 [[package]]
 name = "uuid"
-version = "1.18.1"
+version = "1.19.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
+checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a"
 dependencies = [
  "getrandom 0.3.4",
  "js-sys",
@@ -1614,18 +1561,6 @@ dependencies = [
  "wasm-bindgen",
 ]
 
-[[package]]
-name = "value-trait"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e80f0c733af0720a501b3905d22e2f97662d8eacfe082a75ed7ffb5ab08cb59"
-dependencies = [
- "float-cmp",
- "halfbrown",
- "itoa",
- "ryu",
-]
-
 [[package]]
 name = "vcpkg"
 version = "0.2.15"
@@ -1653,12 +1588,6 @@ dependencies = [
  "wit-bindgen",
 ]
 
-[[package]]
-name = "wasite"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
-
 [[package]]
 name = "wasm-bindgen"
 version = "0.2.106"
@@ -1704,27 +1633,6 @@ dependencies = [
  "unicode-ident",
 ]
 
-[[package]]
-name = "web-sys"
-version = "0.3.83"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "whoami"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d"
-dependencies = [
- "libredox",
- "wasite",
- "web-sys",
-]
-
 [[package]]
 name = "winapi"
 version = "0.3.9"
@@ -1851,7 +1759,7 @@ checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
 [[package]]
 name = "xitca-codegen"
 version = "0.4.0"
-source = "git+http://github.com/HFQR/xitca-web?rev=cf70ed7#cf70ed7328c1b6d60c339a7dc67be454f59b1736"
+source = "git+http://github.com/HFQR/xitca-web?rev=83b4a60#83b4a607a9a704a4286dd190209e567316589afc"
 dependencies = [
  "quote",
  "syn",
@@ -1860,7 +1768,7 @@ dependencies = [
 [[package]]
 name = "xitca-http"
 version = "0.7.1"
-source = "git+http://github.com/HFQR/xitca-web?rev=cf70ed7#cf70ed7328c1b6d60c339a7dc67be454f59b1736"
+source = "git+http://github.com/HFQR/xitca-web?rev=83b4a60#83b4a607a9a704a4286dd190209e567316589afc"
 dependencies = [
  "futures-core",
  "http",
@@ -1868,7 +1776,7 @@ dependencies = [
  "httpdate",
  "itoa",
  "pin-project-lite",
- "socket2 0.6.1",
+ "socket2",
  "tokio",
  "tokio-uring",
  "tracing",
@@ -1893,7 +1801,7 @@ dependencies = [
 [[package]]
 name = "xitca-postgres"
 version = "0.3.0"
-source = "git+http://github.com/HFQR/xitca-web?rev=cf70ed7#cf70ed7328c1b6d60c339a7dc67be454f59b1736"
+source = "git+http://github.com/HFQR/xitca-web?rev=83b4a60#83b4a607a9a704a4286dd190209e567316589afc"
 dependencies = [
  "fallible-iterator",
  "futures-core",
@@ -1909,7 +1817,7 @@ dependencies = [
 [[package]]
 name = "xitca-postgres-diesel"
 version = "0.2.0"
-source = "git+https://github.com/fakeshadow/xitca-postgres-diesel?rev=7671975#7671975951fdd71bfaedaa1686aa7c69e4af6caf"
+source = "git+https://github.com/fakeshadow/xitca-postgres-diesel?rev=fb5dcba#fb5dcba5a89164a880a3e82d62dcb3ae5e99ae6e"
 dependencies = [
  "diesel",
  "diesel-async",
@@ -1946,9 +1854,9 @@ dependencies = [
 [[package]]
 name = "xitca-server"
 version = "0.5.0"
-source = "git+http://github.com/HFQR/xitca-web?rev=cf70ed7#cf70ed7328c1b6d60c339a7dc67be454f59b1736"
+source = "git+http://github.com/HFQR/xitca-web?rev=83b4a60#83b4a607a9a704a4286dd190209e567316589afc"
 dependencies = [
- "socket2 0.6.1",
+ "socket2",
  "tokio",
  "tokio-uring",
  "tracing",
@@ -1960,7 +1868,7 @@ dependencies = [
 [[package]]
 name = "xitca-service"
 version = "0.3.0"
-source = "git+http://github.com/HFQR/xitca-web?rev=cf70ed7#cf70ed7328c1b6d60c339a7dc67be454f59b1736"
+source = "git+http://github.com/HFQR/xitca-web?rev=83b4a60#83b4a607a9a704a4286dd190209e567316589afc"
 
 [[package]]
 name = "xitca-unsafe-collection"
@@ -1985,10 +1893,9 @@ dependencies = [
  "mimalloc",
  "rand 0.9.2",
  "sailfish",
- "serde",
+ "serde_core",
  "serde_json",
- "simd-json",
- "simd-json-derive",
+ "sonic-rs",
  "toasty",
  "tokio",
  "tokio-uring",
@@ -2006,7 +1913,7 @@ dependencies = [
 [[package]]
 name = "xitca-web"
 version = "0.7.1"
-source = "git+http://github.com/HFQR/xitca-web?rev=cf70ed7#cf70ed7328c1b6d60c339a7dc67be454f59b1736"
+source = "git+http://github.com/HFQR/xitca-web?rev=83b4a60#83b4a607a9a704a4286dd190209e567316589afc"
 dependencies = [
  "futures-core",
  "pin-project-lite",

+ 27 - 21
frameworks/Rust/xitca-web/Cargo.toml

@@ -6,22 +6,22 @@ edition = "2024"
 [[bin]]
 name = "xitca-web"
 path = "./src/main.rs"
-required-features = ["io-uring", "pg", "router", "template"]
+required-features = ["io-uring", "json", "pg", "router", "template"]
 
 [[bin]]
-name = "xitca-web-unrealistic"
-path = "./src/main_unrealistic.rs"
-required-features = ["perf", "pg", "template"]
+name = "xitca-web-barebone"
+path = "./src/main_barebone.rs"
+required-features = ["perf", "perf-json", "pg", "template"]
 
 [[bin]]
 name = "xitca-web-diesel"
 path = "./src/main_orm.rs"
-required-features = ["diesel", "template", "web-codegen"]
+required-features = ["diesel", "perf", "template", "web-codegen"]
 
 [[bin]]
 name = "xitca-web-toasty"
 path = "./src/main_orm.rs"
-required-features = ["toasty", "template", "web-codegen"]
+required-features = ["perf", "template", "toasty", "web-codegen"]
 
 [features]
 # pg client optional
@@ -41,7 +41,11 @@ template = ["dep:sailfish"]
 # io-uring optional
 io-uring = ["dep:tokio-uring", "xitca-http/io-uring", "xitca-server/io-uring"]
 # unrealistic performance optimization
-perf = ["dep:core_affinity", "dep:mimalloc", "tokio/parking_lot", "simd-json", "simd-json-derive"]
+perf = ["dep:core_affinity", "dep:mimalloc", "tokio/parking_lot"]
+# regular json serializer
+json = ["serde_json"]
+# performance optimization json serializer
+perf-json = ["sonic-rs"]
 
 [dependencies]
 xitca-http = "0.7"
@@ -52,8 +56,7 @@ xitca-unsafe-collection = "0.2"
 
 atoi = "2"
 httparse = "1"
-serde = { version = "1" }
-serde_json = { version = "1" }
+serde_core = { version = "1" }
 
 # web optional
 xitca-web = { version = "0.7", features = ["json"], optional = true }
@@ -63,7 +66,7 @@ xitca-postgres = { version = "0.3", optional = true }
 
 # diesel orm optional
 diesel = { version = "2", features = ["postgres"], optional = true }
-diesel-async = { version = "0.7", features = ["bb8", "postgres"], optional = true }
+diesel-async = { version = "0.7", optional = true }
 xitca-postgres-diesel = { version = "0.2", default-features = false, optional = true }
 futures-util = { version = "0.3", default-features = false, optional = true }
 
@@ -80,12 +83,14 @@ 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.17", optional = true }
-simd-json-derive =  { version = "0.18", default-features = false, optional = true }
+
+# json optioanl
+serde_json = { version = "1", optional = true }
+sonic-rs = { version = "0.5.6", optional = true }
 
 futures-core = { version = "0.3", default-features = false }
 rand = { version = "0.9", features = ["os_rng", "small_rng"], default-features = false }
-tokio = "1.41"
+tokio = "1.48"
 
 [profile.release]
 lto = true
@@ -94,17 +99,18 @@ codegen-units = 1
 panic = "abort"
 
 [patch.crates-io]
-xitca-postgres-diesel = { git = "https://github.com/fakeshadow/xitca-postgres-diesel", rev = "7671975" }
+xitca-postgres-diesel = { git = "https://github.com/fakeshadow/xitca-postgres-diesel", rev = "fb5dcba" }
 xitca-postgres-toasty = { git = "https://github.com/fakeshadow/xitca-postgres-toasty", rev = "04bedb8" }
 
 # personal fork for efficient toasty engine fine tuned with pipelined xitca-postgres client
 toasty = { git = "https://github.com/fakeshadow/toasty", branch = "engine" }
 toasty-core = { git = "https://github.com/fakeshadow/toasty", branch = "engine" }
 toasty-sql = { git = "https://github.com/fakeshadow/toasty", branch = "engine" }
-
-xitca-codegen = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
-xitca-http = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
-xitca-postgres = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
-xitca-server = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
-xitca-service = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
-xitca-web = { git = "http://github.com/HFQR/xitca-web", rev = "cf70ed7" }
+tokio-uring = { git = "http://github.com/fakeshadow/tokio-uring", rev = "97d9a98" }
+
+xitca-codegen = { git = "http://github.com/HFQR/xitca-web", rev = "83b4a60" }
+xitca-http = { git = "http://github.com/HFQR/xitca-web", rev = "83b4a60" }
+xitca-postgres = { git = "http://github.com/HFQR/xitca-web", rev = "83b4a60" }
+xitca-server = { git = "http://github.com/HFQR/xitca-web", rev = "83b4a60" }
+xitca-service = { git = "http://github.com/HFQR/xitca-web", rev = "83b4a60" }
+xitca-web = { git = "http://github.com/HFQR/xitca-web", rev = "83b4a60" }

+ 3 - 3
frameworks/Rust/xitca-web/benchmark_config.json

@@ -24,7 +24,7 @@
         "notes": "",
         "versus": ""
       },
-      "unrealistic": {
+      "barebone": {
         "json_url": "/json",
         "plaintext_url": "/plaintext",
         "db_url": "/db",
@@ -32,7 +32,7 @@
         "query_url": "/queries?q=",
         "update_url": "/updates?q=",
         "port": 8080,
-        "approach": "Stripped",
+        "approach": "Realistic",
         "classification": "Platform",
         "database": "Postgres",
         "framework": "xitca-web",
@@ -42,7 +42,7 @@
         "webserver": "xitca-server",
         "os": "Linux",
         "database_os": "Linux",
-        "display_name": "xitca-web [unrealistic]",
+        "display_name": "xitca-web [barebone]",
         "notes": "",
         "versus": ""
       },

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

@@ -1,26 +1,24 @@
 #[path = "./db_util.rs"]
 mod db_util;
 
-use core::cell::RefCell;
-
-use xitca_postgres::{Execute, iter::AsyncLendingIterator, pipeline::Pipeline, pool::Pool};
+use xitca_postgres::{Execute, iter::AsyncLendingIterator, pool::Pool};
 
 use super::{
     ser::{Fortune, Fortunes, World},
-    util::{DB_URL, HandleResult},
+    util::{DB_URL, HandleResult, Rand},
 };
 
-use db_util::{FORTUNE_STMT, Shared, UPDATE_STMT, WORLD_STMT, not_found};
+use db_util::{FORTUNE_STMT, UPDATE_STMT, WORLD_STMT, not_found};
 
 pub struct Client {
     pool: Pool,
-    shared: RefCell<Shared>,
+    rng: core::cell::RefCell<Rand>,
 }
 
 pub async fn create() -> HandleResult<Client> {
     Ok(Client {
         pool: Pool::builder(DB_URL).capacity(1).build()?,
-        shared: Default::default(),
+        rng: Default::default(),
     })
 }
 
@@ -28,7 +26,7 @@ impl Client {
     pub async fn get_world(&self) -> HandleResult<World> {
         let mut conn = self.pool.get().await?;
         let stmt = WORLD_STMT.execute(&mut conn).await?;
-        let id = self.shared.borrow_mut().0.gen_id();
+        let id = self.rng.borrow_mut().gen_id();
         let mut res = stmt.bind([id]).query(&conn.consume()).await?;
         let row = res.try_next().await?.ok_or_else(not_found)?;
         Ok(World::new(row.get(0), row.get(1)))
@@ -38,19 +36,21 @@ impl Client {
         let mut conn = self.pool.get().await?;
         let stmt = WORLD_STMT.execute(&mut conn).await?;
 
-        let mut res = {
-            let (ref mut rng, ref mut buf) = *self.shared.borrow_mut();
-            let mut pipe = Pipeline::with_capacity_from_buf(num as _, buf);
-            rng.gen_multi()
-                .take(num as _)
-                .try_for_each(|id| stmt.bind([id]).query(&mut pipe))?;
-            pipe.query(&conn.consume())?
-        };
+        let get = self
+            .rng
+            .borrow_mut()
+            .gen_multi()
+            .take(num as _)
+            .map(|id| stmt.bind([id]).query(&conn))
+            .collect::<Vec<_>>();
+
+        drop(conn);
 
         let mut worlds = Vec::with_capacity(num as _);
 
-        while let Some(mut item) = res.try_next().await? {
-            let row = item.try_next().await?.ok_or_else(not_found)?;
+        for get in get {
+            let mut res = get.await?;
+            let row = res.try_next().await?.ok_or_else(not_found)?;
             worlds.push(World::new(row.get(0), row.get(1)));
         }
 
@@ -62,32 +62,32 @@ impl Client {
         let world_stmt = WORLD_STMT.execute(&mut conn).await?;
         let update_stmt = UPDATE_STMT.execute(&mut conn).await?;
 
-        let (mut res, worlds) = {
-            let (ref mut rng, ref mut buf) = *self.shared.borrow_mut();
-            let mut pipe = Pipeline::with_capacity_from_buf((num + 1) as _, buf);
-
+        let (get, update, worlds) = {
+            let mut rng = self.rng.borrow_mut();
             let mut ids = rng.gen_multi().take(num as _).collect::<Vec<_>>();
             ids.sort();
 
-            let (rngs, worlds) = ids
+            let (get, rngs, worlds) = ids
                 .iter()
                 .cloned()
                 .zip(rng.gen_multi())
                 .map(|(id, rand)| {
-                    world_stmt.bind([id]).query(&mut pipe)?;
-                    HandleResult::Ok((rand, World::new(id, rand)))
+                    let get = world_stmt.bind([id]).query(&conn);
+                    (get, rand, World::new(id, rand))
                 })
-                .collect::<HandleResult<(Vec<_>, Vec<_>)>>()?;
-            update_stmt.bind([&ids, &rngs]).query(&mut pipe)?;
-            (pipe.query(&conn.consume())?, worlds)
+                .collect::<(Vec<_>, Vec<_>, Vec<_>)>();
+
+            let update = update_stmt.bind([&ids, &rngs]).query(&conn.consume());
+
+            (get, update, worlds)
         };
 
-        while let Some(mut item) = res.try_next().await? {
-            while let Some(row) = item.try_next().await? {
-                let _rand = row.get::<i32>(1);
-            }
+        for fut in get {
+            let _rand = fut.await?.try_next().await?.ok_or_else(not_found)?.get::<i32>(1);
         }
 
+        update.await?;
+
         Ok(worlds)
     }
 

+ 8 - 20
frameworks/Rust/xitca-web/src/db_diesel.rs

@@ -1,8 +1,5 @@
 use diesel::prelude::*;
-use diesel_async::{
-    RunQueryDsl,
-    pooled_connection::{AsyncDieselConnectionManager, bb8},
-};
+use diesel_async::{AsyncConnection, RunQueryDsl};
 use futures_util::future::{TryFutureExt, TryJoinAll, try_join};
 use xitca_postgres_diesel::AsyncPgConnection;
 
@@ -12,18 +9,13 @@ use crate::{
 };
 
 pub struct Pool {
-    pool: bb8::Pool<AsyncPgConnection>,
+    pool: AsyncPgConnection,
     rng: core::cell::RefCell<Rand>,
 }
 
 impl Pool {
     pub async fn create() -> HandleResult<Self> {
-        let pool = bb8::Pool::builder()
-            .max_size(1)
-            .min_idle(Some(1))
-            .test_on_check_out(false)
-            .build(AsyncDieselConnectionManager::new(DB_URL))
-            .await?;
+        let pool = AsyncPgConnection::establish(DB_URL).await?;
 
         Ok(Self {
             pool,
@@ -36,8 +28,7 @@ impl Pool {
             use schema::world::dsl::*;
 
             let w_id = self.rng.borrow_mut().gen_id();
-            let mut conn = self.pool.get().await?;
-            world.filter(id.eq(w_id)).first(&mut conn).map_err(Into::into)
+            world.filter(id.eq(w_id)).first(&mut &self.pool).map_err(Into::into)
         }
         .await
     }
@@ -46,12 +37,11 @@ impl Pool {
         {
             use schema::world::dsl::*;
 
-            let mut conn = self.pool.get().await?;
             self.rng
                 .borrow_mut()
                 .gen_multi()
                 .take(num as _)
-                .map(|w_id| world.filter(id.eq(w_id)).first(&mut conn).map_err(Into::into))
+                .map(|w_id| world.filter(id.eq(w_id)).first(&mut &self.pool).map_err(Into::into))
                 .collect::<TryJoinAll<_>>()
         }
         .await
@@ -61,7 +51,6 @@ impl Pool {
         {
             use schema::world::dsl::*;
 
-            let mut conn = self.pool.get().await?;
             let mut rng = self.rng.borrow_mut();
             let mut params = Vec::with_capacity(num as _);
 
@@ -71,7 +60,7 @@ impl Pool {
                 .take(num as _)
                 .zip(rng.gen_multi())
                 .map(|(w_id, rng)| {
-                    let get = world.filter(id.eq(w_id)).first::<World>(&mut conn);
+                    let get = world.filter(id.eq(w_id)).first::<World>(&mut &self.pool);
 
                     params.push((w_id, rng));
 
@@ -84,7 +73,7 @@ impl Pool {
                 .collect::<TryJoinAll<_>>();
 
             let sql = update_query_from_ids(params);
-            let update = diesel::sql_query(sql).execute(&mut conn).map_err(Into::into);
+            let update = diesel::sql_query(sql).execute(&mut &self.pool).map_err(Into::into);
 
             try_join(get, update)
         }
@@ -96,8 +85,7 @@ impl Pool {
         {
             use schema::fortune::dsl::*;
 
-            let mut conn = self.pool.get().await?;
-            fortune.load(&mut conn).map_err(Into::into)
+            fortune.load(&mut &self.pool).map_err(Into::into)
         }
         .await
         .map(Fortunes::new)

+ 0 - 1
frameworks/Rust/xitca-web/src/db_toasty.rs

@@ -6,7 +6,6 @@ use crate::{
     util::{DB_URL, HandleResult, Rand},
 };
 
-// this is not a realistic connection pool.
 pub struct Pool {
     db: Db,
     rng: core::cell::RefCell<Rand>,

+ 30 - 36
frameworks/Rust/xitca-web/src/db_unrealistic.rs

@@ -4,20 +4,18 @@
 #[path = "./db_util.rs"]
 mod db_util;
 
-use std::cell::RefCell;
-
-use xitca_postgres::{Execute, iter::AsyncLendingIterator, pipeline::Pipeline, statement::Statement};
+use xitca_postgres::{Execute, iter::AsyncLendingIterator, statement::Statement};
 
 use super::{
     ser::{Fortune, Fortunes, World},
-    util::{DB_URL, HandleResult},
+    util::{DB_URL, HandleResult, Rand},
 };
 
-use db_util::{FORTUNE_STMT, Shared, UPDATE_STMT, WORLD_STMT, not_found};
+use db_util::{FORTUNE_STMT, UPDATE_STMT, WORLD_STMT, not_found};
 
 pub struct Client {
     cli: xitca_postgres::Client,
-    shared: RefCell<Shared>,
+    rng: core::cell::RefCell<Rand>,
     fortune: Statement,
     world: Statement,
     update: Statement,
@@ -37,7 +35,7 @@ pub async fn create() -> HandleResult<Client> {
 
     Ok(Client {
         cli,
-        shared: Default::default(),
+        rng: Default::default(),
         world,
         fortune,
         update,
@@ -46,63 +44,59 @@ pub async fn create() -> HandleResult<Client> {
 
 impl Client {
     pub async fn get_world(&self) -> HandleResult<World> {
-        let id = self.shared.borrow_mut().0.gen_id();
+        let id = self.rng.borrow_mut().gen_id();
         let mut res = self.world.bind([id]).query(&self.cli).await?;
         let row = res.try_next().await?.ok_or_else(not_found)?;
         Ok(World::new(row.get(0), row.get(1)))
     }
 
     pub async fn get_worlds(&self, num: u16) -> HandleResult<Vec<World>> {
-        let mut res = {
-            let (ref mut rng, ref mut buf) = *self.shared.borrow_mut();
-            let mut pipe = Pipeline::with_capacity_from_buf(num as _, buf);
-            rng.gen_multi()
-                .take(num as _)
-                .try_for_each(|id| self.world.bind([id]).query(&mut pipe))?;
-            pipe.query(&self.cli)?
-        };
+        let get = self
+            .rng
+            .borrow_mut()
+            .gen_multi()
+            .take(num as _)
+            .map(|id| self.world.bind([id]).query(&self.cli))
+            .collect::<Vec<_>>();
 
         let mut worlds = Vec::with_capacity(num as _);
 
-        while let Some(mut item) = res.try_next().await? {
-            while let Some(row) = item.try_next().await? {
-                worlds.push(World::new(row.get(0), row.get(1)));
-            }
+        for query in get {
+            let mut res = query.await?;
+            let row = res.try_next().await?.ok_or_else(not_found)?;
+            worlds.push(World::new(row.get(0), row.get(1)));
         }
 
         Ok(worlds)
     }
 
     pub async fn update(&self, num: u16) -> HandleResult<Vec<World>> {
-        let len = num as usize;
-
-        let (mut res, worlds) = {
-            let (ref mut rng, ref mut buf) = *self.shared.borrow_mut();
-            let mut pipe = Pipeline::with_capacity_from_buf(len + 1, buf);
-
+        let (get, update, worlds) = {
+            let mut rng = self.rng.borrow_mut();
             let mut ids = rng.gen_multi().take(num as _).collect::<Vec<_>>();
             ids.sort();
 
-            let (rngs, worlds) = ids
+            let (get, rngs, worlds) = ids
                 .iter()
                 .cloned()
                 .zip(rng.gen_multi())
                 .map(|(id, rand)| {
-                    self.world.bind([id]).query(&mut pipe)?;
-                    HandleResult::Ok((rand, World::new(id, rand)))
+                    let get = self.world.bind([id]).query(&self.cli);
+                    (get, rand, World::new(id, rand))
                 })
-                .collect::<HandleResult<(Vec<_>, Vec<_>)>>()?;
-            self.update.bind([&ids, &rngs]).query(&mut pipe)?;
+                .collect::<(Vec<_>, Vec<_>, Vec<_>)>();
+
+            let update = self.update.bind([&ids, &rngs]).query(&self.cli);
 
-            (pipe.query(&self.cli)?, worlds)
+            (get, update, worlds)
         };
 
-        while let Some(mut item) = res.try_next().await? {
-            while let Some(row) = item.try_next().await? {
-                let _rand = row.get::<i32>(1);
-            }
+        for fut in get {
+            let _rand = fut.await?.try_next().await?.ok_or_else(not_found)?.get::<i32>(1);
         }
 
+        update.await?;
+
         Ok(worlds)
     }
 

+ 15 - 25
frameworks/Rust/xitca-web/src/db_util.rs

@@ -1,31 +1,21 @@
-#[cfg(feature = "pg")]
-pub use pg::*;
+use xitca_postgres::{
+    statement::{Statement, StatementNamed},
+    types::Type,
+};
 
-#[cfg(feature = "pg")]
-pub mod pg {
-    #![allow(dead_code)]
+use crate::util::Error;
 
-    use xitca_io::bytes::BytesMut;
-    use xitca_postgres::{
-        statement::{Statement, StatementNamed},
-        types::Type,
-    };
+pub const FORTUNE_STMT: StatementNamed = Statement::named("SELECT id,message FROM fortune", &[]);
 
-    use crate::util::{Error, Rand};
+pub const WORLD_STMT: StatementNamed = Statement::named("SELECT id,randomnumber FROM world WHERE id=$1", &[Type::INT4]);
 
-    pub type Shared = (Rand, BytesMut);
+pub const UPDATE_STMT: StatementNamed = Statement::named(
+    "UPDATE world SET randomnumber=w.r FROM (SELECT unnest($1) as i,unnest($2) as r) w WHERE world.id=w.i",
+    &[Type::INT4_ARRAY, Type::INT4_ARRAY],
+);
 
-    pub const FORTUNE_STMT: StatementNamed = Statement::named("SELECT id,message FROM fortune", &[]);
-    pub const WORLD_STMT: StatementNamed =
-        Statement::named("SELECT id,randomnumber FROM world WHERE id=$1", &[Type::INT4]);
-    pub const UPDATE_STMT: StatementNamed = Statement::named(
-        "UPDATE world SET randomnumber=w.r FROM (SELECT unnest($1) as i,unnest($2) as r) w WHERE world.id=w.i",
-        &[Type::INT4_ARRAY, Type::INT4_ARRAY],
-    );
-
-    #[cold]
-    #[inline(never)]
-    pub fn not_found() -> Error {
-        "request World does not exist".into()
-    }
+#[cold]
+#[inline(never)]
+pub fn not_found() -> Error {
+    "request World does not exist".into()
 }

+ 0 - 1
frameworks/Rust/xitca-web/src/main.rs

@@ -47,7 +47,6 @@ fn main() -> std::io::Result<()> {
             "/fortunes",
             get(fn_service(async |ctx: Ctx| {
                 let (req, state) = ctx.into_parts();
-                use sailfish::TemplateOnce;
                 let fortunes = state.client.tell_fortune().await?.render_once()?;
                 req.html_response(fortunes)
             })),

+ 6 - 8
frameworks/Rust/xitca-web/src/main_unrealistic.rs → frameworks/Rust/xitca-web/src/main_barebone.rs

@@ -13,14 +13,11 @@ mod util;
 use std::io;
 
 use xitca_http::{
-    bytes::BufMutWriter,
+    bytes::BufMut,
     h1::dispatcher_unreal::{Dispatcher, Request, Response},
     http::StatusCode,
 };
 use xitca_service::Service;
-// simd-json crate is realistic approach to json serializer.
-// That said xitca-web by default utilize serde-json as serializer making it an unrealistic representation of framework performance
-use simd_json_derive::Serialize;
 
 use self::{
     ser::Message,
@@ -109,11 +106,12 @@ async fn handler<'h>(req: Request<'h, State<db::Client>>, res: Response<'h>) ->
             .header("server", "X")
             // unrealistic content length header.
             .header("content-length", "27")
-            .body_writer(|buf| Message::new().json_write(&mut BufMutWriter(buf)).unwrap()),
+            // snoic-rs crate is realistic approach to json serializer.
+            // That said xitca-web by default utilize serde-json as serializer making it an unrealistic representation of framework performance
+            .body_writer(|buf| sonic_rs::to_writer(buf.writer(), &Message::new()).unwrap()),
 
         // all database related categories are unrealistic. please reference db_unrealistic module for detail.
         "/fortunes" => {
-            use sailfish::TemplateOnce;
             let fortunes = req.ctx.client.tell_fortune().await.unwrap().render_once().unwrap();
             res.status(StatusCode::OK)
                 .header("content-type", "text/html; charset=utf-8")
@@ -142,10 +140,10 @@ async fn handler<'h>(req: Request<'h, State<db::Client>>, res: Response<'h>) ->
 
 fn json_response<'r, DB, T>(res: Response<'r>, state: &State<DB>, val: &T) -> Response<'r, 3>
 where
-    T: Serialize,
+    T: serde_core::Serialize,
 {
     let buf = &mut *state.write_buf.borrow_mut();
-    val.json_write(&mut BufMutWriter(buf)).unwrap();
+    sonic_rs::to_writer(buf.writer(), val).unwrap();
     let res = res
         .status(StatusCode::OK)
         .header("content-type", "application/json")

+ 3 - 1
frameworks/Rust/xitca-web/src/main_orm.rs

@@ -1,3 +1,6 @@
+#[global_allocator]
+static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
+
 mod ser;
 mod util;
 
@@ -47,7 +50,6 @@ async fn db(StateRef(pool): StateRef<'_, Pool>) -> HandleResult<Json<World>> {
 
 #[route("/fortunes", method = get)]
 async fn fortunes(StateRef(pool): StateRef<'_, Pool>) -> HandleResult<Html<String>> {
-    use sailfish::TemplateOnce;
     let html = pool.tell_fortune().await?.render_once()?;
     Ok(Html(html))
 }

+ 23 - 34
frameworks/Rust/xitca-web/src/ser.rs

@@ -1,22 +1,23 @@
 #![allow(dead_code)]
 
-use serde::{Deserialize, Deserializer, Serialize, Serializer, ser::SerializeStruct};
+use std::borrow::Cow;
+
+use serde_core::{Deserialize, Deserializer, Serialize, Serializer, ser::SerializeStruct};
 use xitca_http::{
     body::Once,
-    bytes::{BufMutWriter, Bytes},
+    bytes::Bytes,
     http::{
         self, IntoResponse as _, RequestExt, StatusCode,
-        const_header_value::{JSON, TEXT_HTML_UTF8, TEXT_UTF8},
+        const_header_value::{TEXT_HTML_UTF8, TEXT_UTF8},
         header::CONTENT_TYPE,
     },
 };
 
-use crate::util::{Error, State};
+use crate::util::Error;
 
 const HELLO: &str = "Hello, World!";
 const HELLO_BYTES: &[u8] = HELLO.as_bytes();
 
-#[cfg_attr(feature = "perf", derive(simd_json_derive::Serialize))]
 #[derive(Clone)]
 pub struct Message {
     message: &'static str,
@@ -34,7 +35,6 @@ pub struct Num(pub u16);
 #[cfg_attr(feature = "diesel", derive(diesel::Queryable))]
 #[cfg_attr(feature = "toasty", derive(toasty::Model))]
 #[cfg_attr(feature = "toasty", table = "world")]
-#[cfg_attr(feature = "perf", derive(simd_json_derive::Serialize))]
 pub struct World {
     #[cfg_attr(feature = "toasty", key)]
     pub id: i32,
@@ -54,27 +54,12 @@ impl World {
 pub struct Fortune {
     #[cfg_attr(feature = "toasty", key)]
     pub id: i32,
-    #[cfg(not(feature = "toasty"))]
-    pub message: std::borrow::Cow<'static, str>,
-    #[cfg(feature = "toasty")]
-    pub message: String,
+    pub message: Cow<'static, str>,
 }
 
-#[cfg(not(feature = "toasty"))]
 impl Fortune {
     #[inline]
-    pub fn new(id: i32, message: impl Into<std::borrow::Cow<'static, str>>) -> Self {
-        Self {
-            id,
-            message: message.into(),
-        }
-    }
-}
-
-#[cfg(feature = "toasty")]
-impl Fortune {
-    #[inline]
-    pub fn new(id: i32, message: impl Into<String>) -> Self {
+    pub fn new(id: i32, message: impl Into<Cow<'static, str>>) -> Self {
         Self {
             id,
             message: message.into(),
@@ -90,8 +75,8 @@ pub struct Fortunes {
 // using the macro does not have any perf cost and this piece of code is expanded manually to speed up compile time of
 // bench to reduce resource usage of bench runner
 #[cfg(feature = "template")]
-impl sailfish::TemplateOnce for Fortunes {
-    fn render_once(self) -> sailfish::RenderResult {
+impl Fortunes {
+    pub fn render_once(self) -> sailfish::RenderResult {
         use sailfish::runtime::{Buffer, Render};
 
         const PREFIX: &str = "<!DOCTYPE html>\n<html>\n<head><title>Fortunes</title></head>\n<body>\n<table>\n<tr><th>id</th><th>message</th></tr>\n";
@@ -111,10 +96,6 @@ impl sailfish::TemplateOnce for Fortunes {
 
         Ok(buf.into_string())
     }
-
-    fn render_once_to(self, _: &mut sailfish::runtime::Buffer) -> Result<(), sailfish::runtime::RenderError> {
-        unimplemented!("")
-    }
 }
 
 impl Fortunes {
@@ -133,7 +114,7 @@ impl<'de> Deserialize<'de> for Num {
     {
         use core::fmt;
 
-        use serde::de::{Error, MapAccess, Visitor};
+        use serde_core::de::{Error, MapAccess, Visitor};
 
         const FIELDS: &[&str] = &["q"];
 
@@ -217,7 +198,8 @@ pub type Request<B> = http::Request<RequestExt<B>>;
 pub type Response = http::Response<Once<Bytes>>;
 
 pub trait IntoResponse: Sized {
-    fn json_response<C>(self, state: &State<C>, val: &impl Serialize) -> Result<Response, Error>;
+    #[cfg(any(feature = "json", feature = "perf-json"))]
+    fn json_response<C>(self, state: &crate::util::State<C>, val: &impl Serialize) -> Result<Response, Error>;
 
     fn text_response(self) -> Result<Response, Error>;
 
@@ -225,11 +207,18 @@ pub trait IntoResponse: Sized {
 }
 
 impl<Ext> IntoResponse for Request<Ext> {
-    fn json_response<C>(self, state: &State<C>, val: &impl Serialize) -> Result<Response, Error> {
+    #[cfg(any(feature = "json", feature = "perf-json"))]
+    fn json_response<C>(self, state: &crate::util::State<C>, val: &impl Serialize) -> Result<Response, Error> {
         let buf = &mut *state.write_buf.borrow_mut();
-        serde_json::to_writer(BufMutWriter(buf), val)?;
+        #[cfg(all(feature = "json", not(feature = "perf-json")))]
+        serde_json::to_writer(xitca_http::bytes::BufMutWriter(buf), val)?;
+
+        #[cfg(all(feature = "perf-json", not(feature = "json")))]
+        sonic_rs::to_writer(xitca_http::bytes::BufMut::writer(&mut *buf), val)?;
+
         let mut res = self.into_response(buf.split().freeze());
-        res.headers_mut().insert(CONTENT_TYPE, JSON);
+        res.headers_mut()
+            .insert(CONTENT_TYPE, xitca_http::http::const_header_value::JSON);
         Ok(res)
     }
 

+ 0 - 10
frameworks/Rust/xitca-web/templates/fortune.stpl

@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head><title>Fortunes</title></head>
-  <body>
-    <table>
-      <tr><th>id</th><th>message</th></tr>
-      <% for item in self.items { %><tr><td><%= item.id %></td><td><%= &*item.message %></td></tr><% } %>
-    </table>
-  </body>
-</html>

+ 10 - 0
frameworks/Rust/xitca-web/xitca-web-barebone.dockerfile

@@ -0,0 +1,10 @@
+FROM rust:1.91.1
+
+ADD ./ /xitca-web
+WORKDIR /xitca-web
+
+RUN cargo build --release --bin xitca-web-barebone --features perf,perf-json,pg,template
+
+EXPOSE 8080
+
+CMD ./target/release/xitca-web-barebone

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

@@ -3,7 +3,7 @@ FROM rust:1.91.1
 ADD ./ /xitca-web
 WORKDIR /xitca-web
 
-RUN cargo build --release --bin xitca-web-diesel --features diesel,template,web-codegen
+RUN cargo build --release --bin xitca-web-diesel --features diesel,perf,template,web-codegen
 
 EXPOSE 8080
 

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

@@ -3,7 +3,7 @@ FROM rust:1.91.1
 ADD ./ /xitca-web
 WORKDIR /xitca-web
 
-RUN cargo build --release --bin xitca-web-toasty --features toasty,template,web-codegen
+RUN cargo build --release --bin xitca-web-toasty --features perf,template,toasty,web-codegen
 
 EXPOSE 8080
 

+ 0 - 10
frameworks/Rust/xitca-web/xitca-web-unrealistic.dockerfile

@@ -1,10 +0,0 @@
-FROM rust:1.91.1
-
-ADD ./ /xitca-web
-WORKDIR /xitca-web
-
-RUN cargo build --release --bin xitca-web-unrealistic --features perf,pg,template
-
-EXPOSE 8080
-
-CMD ./target/release/xitca-web-unrealistic

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

@@ -3,7 +3,7 @@ FROM rust:1.91.1
 ADD ./ /xitca-web
 WORKDIR /xitca-web
 
-RUN cargo build --release --bin xitca-web --features io-uring,pg,router,template
+RUN cargo build --release --bin xitca-web --features io-uring,json,pg,router,template
 
 EXPOSE 8080