mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 11:26:29 +03:00
sql: organize connection pool as a stack rather than a queue
When connection pool is organized as a stack, it always returns most recently used connection. Because each connection has its own page cache, using the connection with fresh cache improves performance. I commented out `oauth2::tests::test_oauth_from_mx` because it requires network connection, turned off the Wi-Fi and ran the tests. Before the change, with a queue: ``` $ hyperfine "cargo test" Benchmark 1: cargo test Time (mean ± σ): 56.424 s ± 4.515 s [User: 183.181 s, System: 128.156 s] Range (min … max): 52.123 s … 68.193 s 10 runs ``` With a stack: ``` $ hyperfine "cargo test" Benchmark 1: cargo test Time (mean ± σ): 29.887 s ± 1.377 s [User: 101.226 s, System: 45.573 s] Range (min … max): 26.591 s … 31.010 s 10 runs ``` On version 1.107.1: ``` $ hyperfine "cargo test" Benchmark 1: cargo test Time (mean ± σ): 43.658 s ± 1.079 s [User: 202.582 s, System: 50.723 s] Range (min … max): 41.531 s … 45.170 s 10 runs ```
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -848,7 +848,6 @@ dependencies = [
|
||||
"bitflags",
|
||||
"chrono",
|
||||
"criterion",
|
||||
"crossbeam-queue",
|
||||
"deltachat_derive",
|
||||
"email",
|
||||
"encoded-words",
|
||||
@@ -870,6 +869,7 @@ dependencies = [
|
||||
"num-traits",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"percent-encoding",
|
||||
"pgp",
|
||||
"pretty_env_logger",
|
||||
|
||||
Reference in New Issue
Block a user