mirror of https://github.com/astral-sh/ruff
Disable jemalloc decay in benchmarks (#13299)
This commit is contained in:
parent
1d5bd89987
commit
a528edad35
|
|
@ -66,4 +66,4 @@ codspeed = ["codspeed-criterion-compat"]
|
||||||
mimalloc = { workspace = true }
|
mimalloc = { workspace = true }
|
||||||
|
|
||||||
[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64")))'.dev-dependencies]
|
[target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64")))'.dev-dependencies]
|
||||||
tikv-jemallocator = { workspace = true }
|
tikv-jemallocator = { workspace = true, features = ["unprefixed_malloc_on_supported_platforms"] }
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,24 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
||||||
|
|
||||||
|
// Disable decay after 10s because it can show up as *random* slow allocations
|
||||||
|
// in benchmarks. We don't need purging in benchmarks because it isn't important
|
||||||
|
// to give unallocated pages back to the OS.
|
||||||
|
// https://jemalloc.net/jemalloc.3.html#opt.dirty_decay_ms
|
||||||
|
#[cfg(all(
|
||||||
|
not(target_os = "windows"),
|
||||||
|
not(target_os = "openbsd"),
|
||||||
|
any(
|
||||||
|
target_arch = "x86_64",
|
||||||
|
target_arch = "aarch64",
|
||||||
|
target_arch = "powerpc64"
|
||||||
|
)
|
||||||
|
))]
|
||||||
|
#[allow(non_upper_case_globals)]
|
||||||
|
#[export_name = "malloc_conf"]
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
pub static malloc_conf: &[u8] = b"dirty_decay_ms:-1,muzzy_decay_ms:-1\0";
|
||||||
|
|
||||||
fn create_test_cases() -> Result<Vec<TestCase>, TestFileDownloadError> {
|
fn create_test_cases() -> Result<Vec<TestCase>, TestFileDownloadError> {
|
||||||
Ok(vec![
|
Ok(vec![
|
||||||
TestCase::fast(TestFile::try_download("numpy/globals.py", "https://raw.githubusercontent.com/numpy/numpy/89d64415e349ca75a25250f22b874aa16e5c0973/numpy/_globals.py")?),
|
TestCase::fast(TestFile::try_download("numpy/globals.py", "https://raw.githubusercontent.com/numpy/numpy/89d64415e349ca75a25250f22b874aa16e5c0973/numpy/_globals.py")?),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue