server: don't use parking_lot explicitly anymore

As of Rust 1.62, standard locks will recieve a massive performance
improvement (speed and memory footprint) on Linux.

parking_lot seems to be still be better [1] for the ordinary usecase
but I will still remove it preemptively for 2 reasons:

1. The application isn't still usable, I don't have any benchmarks where
   parking_lot is needed because of critical locks causing a noticable
   bottleneck. (I doubt it will be case anyway)

2. Having a smaller explicit dependency chain is good for
   maintainability. (Don't take this too far as to reduce usability
   though)

Tokio still uses parking_lot by default in itself.
Maybe I'll get rid of it after bumping MSRV to 1.62.

[1]: https://twitter.com/m_ou_se/status/1526220580361490438
Aydin Mercan 2022-05-31 11:46:47 +03:00
parent 1b16619c7c
commit 986d668209
No known key found for this signature in database
3 changed files with 8 additions and 11 deletions

14
Cargo.lock generated
View File

@ -169,7 +169,6 @@ dependencies = [
"axum",
"blake2",
"clap",
"parking_lot",
"rand",
"rusqlite",
"serde",
@ -422,9 +421,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "hyper"
version = "0.14.18"
version = "0.14.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2"
checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f"
dependencies = [
"bytes",
"futures-channel",
@ -446,9 +445,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.8.1"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
dependencies = [
"autocfg",
"hashbrown",
@ -571,9 +570,9 @@ checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
[[package]]
name = "parking_lot"
version = "0.12.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
@ -1064,7 +1063,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596"
dependencies = [
"ansi_term",
"parking_lot",
"sharded-slab",
"smallvec",
"thread_local",

View File

@ -12,14 +12,13 @@ argon2 = "0.4"
blake2 = "0.10"
axum = { version = "0.5", features = ["http2"] }
clap = { version = "3.1", features = ["derive"] }
parking_lot = "0.12"
rand = "0.8"
rusqlite = { version = "0.27", features = ["serde_json", "time", "uuid"] }
serde = { version = "1", features = ["derive"] }
time = { version = "0.3", features = ["serde"] }
tokio = { version = "1.18", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["parking_lot"] }
tracing-subscriber = "0.3"
uuid = { version = "1", features = ["v4", "serde"] }
[profile.release]

View File

@ -6,10 +6,10 @@ mod server;
use std::collections::HashMap;
use std::option::Option;
use std::process::{ExitCode, Termination};
use std::sync::RwLock;
use anyhow::Result;
use clap::{Parser, Subcommand};
use parking_lot::RwLock;
pub type CsrfMap = RwLock<HashMap<String, String>>;