Added mimalloc as allocator

pull/36/head
Jef Roosens 2021-09-03 16:31:06 +02:00
parent 505907d3a1
commit a6b1b0ff76
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
3 changed files with 24 additions and 1 deletions

19
Cargo.lock generated
View File

@ -648,6 +648,15 @@ version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
[[package]]
name = "libmimalloc-sys"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1b8479c593dba88c2741fc50b92e13dbabbbe0bd504d979f244ccc1a5b1c01"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
version = "0.5.4" version = "0.5.4"
@ -712,6 +721,15 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "mimalloc"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb74897ce508e6c49156fd1476fc5922cbc6e75183c65e399c765a09122e5130"
dependencies = [
"libmimalloc-sys",
]
[[package]] [[package]]
name = "mime" name = "mime"
version = "0.3.16" version = "0.3.16"
@ -1201,6 +1219,7 @@ dependencies = [
"figment", "figment",
"hmac", "hmac",
"jwt", "jwt",
"mimalloc",
"openssl", "openssl",
"rand", "rand",
"rocket", "rocket",

View File

@ -36,8 +36,9 @@ chrono = { version = "*", features = [ "serde" ] }
base64 = "0.13.0" base64 = "0.13.0"
# Reading in configuration files # Reading in configuration files
figment = { version = "*", features = [ "yaml" ] } figment = { version = "*", features = [ "yaml" ] }
mimalloc = { version = "0.1.26", default_features = false }
[profile.release] [profile.release]
lto = true lto = "fat"
panic = "abort" panic = "abort"
codegen-units = 1 codegen-units = 1

View File

@ -28,6 +28,9 @@ pub mod errors;
pub mod guards; pub mod guards;
pub(crate) mod schema; pub(crate) mod schema;
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[database("postgres_rb")] #[database("postgres_rb")]
pub struct RbDbConn(diesel::PgConnection); pub struct RbDbConn(diesel::PgConnection);