refactor: remove global allocator from non-user facing apps (#2401)

The runtime performance gains does not out weight the compilation speed from
building the custom allocators, which takes about a minute to build on
slower machines.
This commit is contained in:
Boshen 2024-02-12 14:09:05 +08:00 committed by GitHub
parent 3ea6c95371
commit 70a0076eed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 0 additions and 80 deletions

10
Cargo.lock generated
View file

@ -1409,10 +1409,8 @@ dependencies = [
"encoding_rs",
"encoding_rs_io",
"futures",
"jemallocator",
"lazy_static",
"miette",
"mimalloc",
"oxc_allocator",
"oxc_ast",
"oxc_codegen",
@ -1538,8 +1536,6 @@ version = "0.7.0"
dependencies = [
"insta",
"itertools 0.12.1",
"jemallocator",
"mimalloc",
"num-bigint",
"num-traits",
"oxc_allocator",
@ -1561,8 +1557,6 @@ dependencies = [
"brotlic",
"flate2",
"humansize",
"jemallocator",
"mimalloc",
"oxc_allocator",
"oxc_codegen",
"oxc_minifier",
@ -1638,8 +1632,6 @@ dependencies = [
name = "oxc_prettier_conformance"
version = "0.0.0"
dependencies = [
"jemallocator",
"mimalloc",
"oxc_allocator",
"oxc_ast",
"oxc_parser",
@ -1739,8 +1731,6 @@ name = "oxc_transform_conformance"
version = "0.0.0"
dependencies = [
"indexmap",
"jemallocator",
"mimalloc",
"oxc_allocator",
"oxc_codegen",
"oxc_diagnostics",

View file

@ -38,9 +38,3 @@ oxc_codegen = { workspace = true }
insta = { workspace = true }
walkdir = { workspace = true }
pico-args = { workspace = true }
[target.'cfg(not(target_env = "msvc"))'.dev-dependencies]
jemallocator = { workspace = true }
[target.'cfg(target_os = "windows")'.dev-dependencies]
mimalloc = { workspace = true }

View file

@ -8,14 +8,6 @@ use oxc_span::SourceType;
use pico_args::Arguments;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
// Instruction:
// create a `test.js`,
// run `cargo run -p oxc_minifier --example minifier`

View file

@ -49,9 +49,3 @@ encoding_rs = "0.8.33"
encoding_rs_io = "0.1.7"
serde_yaml = "0.9.31"
similar = "2.4.0"
[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = { workspace = true }
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = { workspace = true }

View file

@ -1,11 +1,3 @@
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
use oxc_coverage::AppArgs;
use pico_args::Arguments;

View file

@ -27,9 +27,3 @@ flate2 = { workspace = true }
humansize = "2.1.3"
brotlic = "0.8.2"
[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = { workspace = true }
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = { workspace = true }

View file

@ -1,11 +1,3 @@
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
use std::{
fs::File,
io::{self, Write},

View file

@ -26,9 +26,3 @@ oxc_ast = { workspace = true }
walkdir = { workspace = true }
pico-args = { workspace = true }
[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = { workspace = true }
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = { workspace = true }

View file

@ -1,11 +1,3 @@
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
use oxc_prettier_conformance::{TestRunner, TestRunnerOptions};
use pico_args::Arguments;

View file

@ -35,9 +35,3 @@ serde = { workspace = true }
walkdir = { workspace = true }
pico-args = { workspace = true }
indexmap = { workspace = true }
[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = { workspace = true }
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = { workspace = true }

View file

@ -1,13 +1,5 @@
mod ts_fixtures;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
use oxc_transform_conformance::{TestRunner, TestRunnerOptions};
use pico_args::Arguments;
use ts_fixtures::TypeScriptFixtures;