1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

perf: use mimalloc

This commit is contained in:
Kevin Amado 2022-02-26 12:07:35 -05:00
parent 9f33b633a8
commit f354cd50ff
4 changed files with 99 additions and 0 deletions

View file

@ -17,6 +17,33 @@ Types of changes
- Security in case of vulnerabilities.
-->
### Changed
- Linux binaries now use [mimalloc](https://github.com/microsoft/mimalloc)
to provide much better performance when formatting Nixpkgs:
- x86_64-unknown-linux-gnu, 1.3x faster,
from 0m10.639s to 0m8.381s
- x86_64-unknown-linux-musl, 15.8x faster,
from 2m32.686s to 0m9.642s
- [On QEMU](https://www.qemu.org/) aarch64-unknown-linux-musl,
4.6x faster,
from 5m26s to 1m10s
- [On QEMU](https://www.qemu.org/) armv6l-unknown-linux-musleabihf,
1.05x faster,
from 8m7s to 7m41s
- [On QEMU](https://www.qemu.org/) armv7l-unknown-linux-musleabihf,
1.15x faster,
from 5m54s to 5m7s
- [On QEMU](https://www.qemu.org/) i686-unknown-linux-musl,
1.07x faster,
from 2m44s to 2m33s
## [0.6.0] - 2022-02-25
### Added

25
Cargo.lock generated
View file

@ -20,6 +20,7 @@ dependencies = [
name = "alejandra_engine"
version = "0.6.0"
dependencies = [
"mimalloc",
"rnix",
"rowan",
]
@ -62,6 +63,12 @@ dependencies = [
"num-traits",
]
[[package]]
name = "cc"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
version = "1.0.0"
@ -191,6 +198,15 @@ version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]]
name = "libmimalloc-sys"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7705fc40f6ed493f73584abbb324e74f96b358ff60dfe5659a0f8fc12c590a69"
dependencies = [
"cc",
]
[[package]]
name = "memchr"
version = "2.4.1"
@ -206,6 +222,15 @@ dependencies = [
"autocfg",
]
[[package]]
name = "mimalloc"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0dfa131390c2f6bdb3242f65ff271fcdaca5ff7b6c08f28398be7f2280e3926"
dependencies = [
"libmimalloc-sys",
]
[[package]]
name = "num-traits"
version = "0.2.14"

View file

@ -2,6 +2,24 @@
rnix = "*"
rowan = "0.12.6" # follows rnix
[target.aarch64-unknown-linux-musl.dependencies]
mimalloc = { version = "*", default-features = false }
[target.armv6l-unknown-linux-musleabihf.dependencies]
mimalloc = { version = "*", default-features = false }
[target.armv7l-unknown-linux-musleabihf.dependencies]
mimalloc = { version = "*", default-features = false }
[target.i686-unknown-linux-musl.dependencies]
mimalloc = { version = "*", default-features = false }
[target.x86_64-unknown-linux-gnu.dependencies]
mimalloc = { version = "*", default-features = false }
[target.x86_64-unknown-linux-musl.dependencies]
mimalloc = { version = "*", default-features = false }
[package]
authors = ["Kevin Amado <kamadorueda@gmail.com>"]
description = "The Uncompromising Nix Code Formatter"

View file

@ -1,3 +1,32 @@
#[cfg(any(
all(
target_arch = "aarch64",
target_vendor = "unknown",
target_os = "linux",
target_env = "musl"
),
all(
any(target_arch = "armv6l", target_arch = "armv7l",),
target_vendor = "unknown",
target_os = "linux",
target_env = "musleabihf"
),
all(
target_arch = "i686",
target_vendor = "unknown",
target_os = "linux",
target_env = "musl"
),
all(
target_arch = "x86_64",
target_vendor = "unknown",
target_os = "linux",
any(target_env = "gnu", target_env = "musl")
),
))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
pub(crate) mod builder;
pub(crate) mod children;
pub mod format;