Use jemalloc instead of the system allocator for Rust

This commit is contained in:
byte[] 2021-09-12 10:27:02 -04:00
parent f9a7a28df3
commit d2582aac02
4 changed files with 38 additions and 0 deletions

View file

@ -1,5 +1,8 @@
#!/usr/bin/env sh
# For compatibility with musl libc
export CARGO_FEATURE_DISABLE_INITIAL_EXEC_TLS=1
background() {
while :; do
mix run -e 'Philomena.Release.update_channels()'

View file

@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler"
version = "1.0.2"
@ -213,11 +215,18 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "fs_extra"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
[[package]]
name = "furbooru_markdown"
version = "0.1.1"
dependencies = [
"comrak",
"jemallocator",
"lazy_static",
"log",
"pretty_env_logger",
@ -283,6 +292,27 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]]
name = "jemalloc-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
dependencies = [
"cc",
"fs_extra",
"libc",
]
[[package]]
name = "jemallocator"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
dependencies = [
"jemalloc-sys",
"libc",
]
[[package]]
name = "lazy_static"
version = "1.4.0"

View file

@ -16,6 +16,7 @@ regex = "1"
log = "0"
pretty_env_logger = "0"
rustler = "0.22.0"
jemallocator = "0.3.2"
[profile.release]
opt-level = 3

View file

@ -2,6 +2,10 @@ use comrak::{markdown_to_html, ComrakOptions};
use lazy_static::lazy_static;
use regex::{Captures, Regex};
use rustler::Term;
use jemallocator::Jemalloc;
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
mod atoms {
rustler::atoms! {