Use the mimalloc allocator.

This commit is contained in:
Kavin 2023-05-23 04:03:52 +01:00
parent f4617959ba
commit ab1f54bf51
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
3 changed files with 25 additions and 0 deletions

20
Cargo.lock generated
View file

@ -857,6 +857,16 @@ version = "0.2.144"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
[[package]]
name = "libmimalloc-sys"
version = "0.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4ac0e912c8ef1b735e92369695618dc5b1819f5a7bf3f167301a3ba1cea515e"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "libwebp-sys" name = "libwebp-sys"
version = "0.4.2" version = "0.4.2"
@ -918,6 +928,15 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "mimalloc"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e2894987a3459f3ffb755608bd82188f8ed00d0ae077f1edea29c068d639d98"
dependencies = [
"libmimalloc-sys",
]
[[package]] [[package]]
name = "mime" name = "mime"
version = "0.3.17" version = "0.3.17"
@ -1083,6 +1102,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"image", "image",
"mimalloc",
"once_cell", "once_cell",
"qstring", "qstring",
"regex", "regex",

View file

@ -8,6 +8,7 @@ version = "0.1.0"
[dependencies] [dependencies]
actix-web = "4.3.1" actix-web = "4.3.1"
image = "0.24.6" image = "0.24.6"
mimalloc = "0.1.37"
once_cell = "1.17.1" once_cell = "1.17.1"
qstring = "0.7.2" qstring = "0.7.2"
regex = "1.8.2" regex = "1.8.2"

View file

@ -4,11 +4,15 @@ use std::error::Error;
use actix_web::{App, HttpRequest, HttpResponse, HttpResponseBuilder, HttpServer, web}; use actix_web::{App, HttpRequest, HttpResponse, HttpResponseBuilder, HttpServer, web};
use actix_web::http::Method; use actix_web::http::Method;
use image::EncodableLayout; use image::EncodableLayout;
use mimalloc::MiMalloc;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use qstring::QString; use qstring::QString;
use regex::Regex; use regex::Regex;
use reqwest::{Client, Request, Url}; use reqwest::{Client, Request, Url};
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[actix_web::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
println!("Running server!"); println!("Running server!");