feat(tvix): Jemalloc -> MiMalloc

Use the faster and newer MiMalloc memory allocator for all endpoints in
the workspace.

Change-Id: Ic60237284ed168e46ec6e8f28e2710bae4385c6f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12149
Tested-by: BuildkiteCI
Reviewed-by: aspen <root@gws.fyi>
This commit is contained in:
Ilan Joselevich 2024-08-08 00:21:26 +03:00
parent 000fb856be
commit f648f17ec3
18 changed files with 153 additions and 126 deletions

49
tvix/Cargo.lock generated
View file

@ -2073,6 +2073,16 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
[[package]]
name = "libmimalloc-sys"
version = "0.1.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "libredox" name = "libredox"
version = "0.0.1" version = "0.0.1"
@ -2222,6 +2232,15 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "mimalloc"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633"
dependencies = [
"libmimalloc-sys",
]
[[package]] [[package]]
name = "mime" name = "mime"
version = "0.3.17" version = "0.3.17"
@ -2273,6 +2292,7 @@ dependencies = [
"hex-literal", "hex-literal",
"itertools 0.12.0", "itertools 0.12.0",
"lru", "lru",
"mimalloc",
"nix-compat", "nix-compat",
"parking_lot 0.12.3", "parking_lot 0.12.3",
"prost 0.13.1", "prost 0.13.1",
@ -2365,6 +2385,7 @@ dependencies = [
"glob", "glob",
"hex-literal", "hex-literal",
"lazy_static", "lazy_static",
"mimalloc",
"nom", "nom",
"num-traits", "num-traits",
"pin-project-lite", "pin-project-lite",
@ -4148,26 +4169,6 @@ dependencies = [
"num_cpus", "num_cpus",
] ]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.5.4+5.3.0-patched"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.34" version = "0.3.34"
@ -4780,6 +4781,7 @@ dependencies = [
"bytes", "bytes",
"clap", "clap",
"itertools 0.12.0", "itertools 0.12.0",
"mimalloc",
"prost 0.13.1", "prost 0.13.1",
"prost-build 0.13.1", "prost-build 0.13.1",
"rstest", "rstest",
@ -4867,6 +4869,7 @@ dependencies = [
"clap", "clap",
"dirs", "dirs",
"expect-test", "expect-test",
"mimalloc",
"nix-compat", "nix-compat",
"rnix", "rnix",
"rowan", "rowan",
@ -4874,7 +4877,6 @@ dependencies = [
"rustyline", "rustyline",
"smol_str", "smol_str",
"thiserror", "thiserror",
"tikv-jemallocator",
"tokio", "tokio",
"tracing", "tracing",
"tracing-indicatif", "tracing-indicatif",
@ -4904,6 +4906,7 @@ dependencies = [
"lazy_static", "lazy_static",
"lexical-core", "lexical-core",
"md-5", "md-5",
"mimalloc",
"os_str_bytes", "os_str_bytes",
"path-clean", "path-clean",
"pretty_assertions", "pretty_assertions",
@ -4921,7 +4924,6 @@ dependencies = [
"tabwriter", "tabwriter",
"tempfile", "tempfile",
"test-strategy", "test-strategy",
"tikv-jemallocator",
"toml 0.6.0", "toml 0.6.0",
"tvix-eval-builtin-macros", "tvix-eval-builtin-macros",
] ]
@ -4951,6 +4953,7 @@ dependencies = [
"lazy_static", "lazy_static",
"magic", "magic",
"md-5", "md-5",
"mimalloc",
"nix 0.27.1", "nix 0.27.1",
"nix-compat", "nix-compat",
"pin-project", "pin-project",
@ -4963,7 +4966,6 @@ dependencies = [
"sha2", "sha2",
"tempfile", "tempfile",
"thiserror", "thiserror",
"tikv-jemallocator",
"tokio", "tokio",
"tokio-tar", "tokio-tar",
"tokio-util", "tokio-util",
@ -5007,6 +5009,7 @@ dependencies = [
"hyper-util", "hyper-util",
"lazy_static", "lazy_static",
"lru", "lru",
"mimalloc",
"nix-compat", "nix-compat",
"parking_lot 0.12.3", "parking_lot 0.12.3",
"pin-project-lite", "pin-project-lite",

View file

@ -6484,6 +6484,32 @@ rec {
}; };
resolvedDefaultFeatures = [ "default" ]; resolvedDefaultFeatures = [ "default" ];
}; };
"libmimalloc-sys" = rec {
crateName = "libmimalloc-sys";
version = "0.1.39";
edition = "2018";
links = "mimalloc";
sha256 = "0i3b0dzz7cp0ik7ys66q92r16va78gwlbrnxhj5fnkdxsc8niai3";
authors = [
"Octavian Oncescu <octavonce@gmail.com>"
];
dependencies = [
{
name = "libc";
packageId = "libc";
}
];
buildDependencies = [
{
name = "cc";
packageId = "cc";
}
];
features = {
"cty" = [ "dep:cty" ];
"extended" = [ "cty" ];
};
};
"libredox" = rec { "libredox" = rec {
crateName = "libredox"; crateName = "libredox";
version = "0.0.1"; version = "0.0.1";
@ -6883,6 +6909,34 @@ rec {
features = { }; features = { };
resolvedDefaultFeatures = [ "default" ]; resolvedDefaultFeatures = [ "default" ];
}; };
"mimalloc" = rec {
crateName = "mimalloc";
version = "0.1.43";
edition = "2018";
sha256 = "0csnyrxc16i592gm5ffham07jyj2w98qsh9jyy1rv59lmr8474b8";
authors = [
"Octavian Oncescu <octavonce@gmail.com>"
"Vincent Rouillé <vincent@speedy37.fr>"
"Thom Chiovoloni <chiovolonit@gmail.com>"
];
dependencies = [
{
name = "libmimalloc-sys";
packageId = "libmimalloc-sys";
usesDefaultFeatures = false;
}
];
features = {
"debug" = [ "libmimalloc-sys/debug" ];
"debug_in_debug" = [ "libmimalloc-sys/debug_in_debug" ];
"extended" = [ "libmimalloc-sys/extended" ];
"local_dynamic_tls" = [ "libmimalloc-sys/local_dynamic_tls" ];
"no_thp" = [ "libmimalloc-sys/no_thp" ];
"override" = [ "libmimalloc-sys/override" ];
"secure" = [ "libmimalloc-sys/secure" ];
};
resolvedDefaultFeatures = [ "default" ];
};
"mime" = rec { "mime" = rec {
crateName = "mime"; crateName = "mime";
version = "0.3.17"; version = "0.3.17";
@ -7035,6 +7089,10 @@ rec {
name = "lru"; name = "lru";
packageId = "lru"; packageId = "lru";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "nix-compat"; name = "nix-compat";
packageId = "nix-compat"; packageId = "nix-compat";
@ -7372,6 +7430,10 @@ rec {
name = "glob"; name = "glob";
packageId = "glob"; packageId = "glob";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "nom"; name = "nom";
packageId = "nom"; packageId = "nom";
@ -7429,6 +7491,10 @@ rec {
name = "lazy_static"; name = "lazy_static";
packageId = "lazy_static"; packageId = "lazy_static";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "pretty_assertions"; name = "pretty_assertions";
packageId = "pretty_assertions"; packageId = "pretty_assertions";
@ -13059,72 +13125,6 @@ rec {
]; ];
}; };
"tikv-jemalloc-sys" = rec {
crateName = "tikv-jemalloc-sys";
version = "0.5.4+5.3.0-patched";
edition = "2018";
links = "jemalloc";
sha256 = "1lc5vm1p9dqdvd3mn3264zddnd7z6i95ch3y69prnjgxp0y480ll";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
"Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>"
"The TiKV Project Developers"
];
dependencies = [
{
name = "libc";
packageId = "libc";
usesDefaultFeatures = false;
}
];
buildDependencies = [
{
name = "cc";
packageId = "cc";
}
];
features = {
"background_threads" = [ "background_threads_runtime_support" ];
"default" = [ "background_threads_runtime_support" ];
};
resolvedDefaultFeatures = [ "background_threads_runtime_support" ];
};
"tikv-jemallocator" = rec {
crateName = "tikv-jemallocator";
version = "0.5.4";
edition = "2018";
sha256 = "1jpanfm9az8hcbg6dyxdabykx03lj0j4g9cbwfa6rig5dg1f0pwn";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
"Gonzalo Brito Gadeschi <gonzalobg88@gmail.com>"
"Simon Sapin <simon.sapin@exyr.org>"
"Steven Fackler <sfackler@gmail.com>"
"The TiKV Project Developers"
];
dependencies = [
{
name = "libc";
packageId = "libc";
usesDefaultFeatures = false;
}
{
name = "tikv-jemalloc-sys";
packageId = "tikv-jemalloc-sys";
usesDefaultFeatures = false;
}
];
features = {
"background_threads" = [ "tikv-jemalloc-sys/background_threads" ];
"background_threads_runtime_support" = [ "tikv-jemalloc-sys/background_threads_runtime_support" ];
"debug" = [ "tikv-jemalloc-sys/debug" ];
"default" = [ "background_threads_runtime_support" ];
"disable_initial_exec_tls" = [ "tikv-jemalloc-sys/disable_initial_exec_tls" ];
"profiling" = [ "tikv-jemalloc-sys/profiling" ];
"stats" = [ "tikv-jemalloc-sys/stats" ];
"unprefixed_malloc_on_supported_platforms" = [ "tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms" ];
};
resolvedDefaultFeatures = [ "background_threads_runtime_support" "default" ];
};
"time" = rec { "time" = rec {
crateName = "time"; crateName = "time";
version = "0.3.34"; version = "0.3.34";
@ -15530,6 +15530,10 @@ rec {
name = "itertools"; name = "itertools";
packageId = "itertools 0.12.0"; packageId = "itertools 0.12.0";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "prost"; name = "prost";
packageId = "prost 0.13.1"; packageId = "prost 0.13.1";
@ -15894,6 +15898,10 @@ rec {
name = "dirs"; name = "dirs";
packageId = "dirs"; packageId = "dirs";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "nix-compat"; name = "nix-compat";
packageId = "nix-compat"; packageId = "nix-compat";
@ -15922,11 +15930,6 @@ rec {
name = "thiserror"; name = "thiserror";
packageId = "thiserror"; packageId = "thiserror";
} }
{
name = "tikv-jemallocator";
packageId = "tikv-jemallocator";
target = { target, features }: (!("msvc" == target."env" or null));
}
{ {
name = "tokio"; name = "tokio";
packageId = "tokio"; packageId = "tokio";
@ -16120,6 +16123,10 @@ rec {
name = "itertools"; name = "itertools";
packageId = "itertools 0.12.0"; packageId = "itertools 0.12.0";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "pretty_assertions"; name = "pretty_assertions";
packageId = "pretty_assertions"; packageId = "pretty_assertions";
@ -16132,11 +16139,6 @@ rec {
name = "tempfile"; name = "tempfile";
packageId = "tempfile"; packageId = "tempfile";
} }
{
name = "tikv-jemallocator";
packageId = "tikv-jemallocator";
target = { target, features }: (!("msvc" == target."env" or null));
}
]; ];
features = { features = {
"arbitrary" = [ "proptest" "test-strategy" "imbl/proptest" ]; "arbitrary" = [ "proptest" "test-strategy" "imbl/proptest" ];
@ -16252,11 +16254,6 @@ rec {
name = "thiserror"; name = "thiserror";
packageId = "thiserror"; packageId = "thiserror";
} }
{
name = "tikv-jemallocator";
packageId = "tikv-jemallocator";
target = { target, features }: (!("msvc" == target."env" or null));
}
{ {
name = "tokio"; name = "tokio";
packageId = "tokio"; packageId = "tokio";
@ -16327,6 +16324,10 @@ rec {
name = "lazy_static"; name = "lazy_static";
packageId = "lazy_static"; packageId = "lazy_static";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "nix"; name = "nix";
packageId = "nix 0.27.1"; packageId = "nix 0.27.1";
@ -16446,6 +16447,10 @@ rec {
name = "lru"; name = "lru";
packageId = "lru"; packageId = "lru";
} }
{
name = "mimalloc";
packageId = "mimalloc";
}
{ {
name = "nix-compat"; name = "nix-compat";
packageId = "nix-compat"; packageId = "nix-compat";

View file

@ -16,6 +16,7 @@ tvix-castore = { path = "../castore" }
tvix-tracing = { path = "../tracing" } tvix-tracing = { path = "../tracing" }
tracing = "0.1.40" tracing = "0.1.40"
url = "2.4.0" url = "2.4.0"
mimalloc = "0.1.43"
[dependencies.tonic-reflection] [dependencies.tonic-reflection]
optional = true optional = true

View file

@ -17,6 +17,11 @@ use tvix_build::proto::FILE_DESCRIPTOR_SET;
#[cfg(feature = "tonic-reflection")] #[cfg(feature = "tonic-reflection")]
use tvix_castore::proto::FILE_DESCRIPTOR_SET as CASTORE_FILE_DESCRIPTOR_SET; use tvix_castore::proto::FILE_DESCRIPTOR_SET as CASTORE_FILE_DESCRIPTOR_SET;
use mimalloc::MiMalloc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[derive(Parser)] #[derive(Parser)]
#[command(author, version, about, long_about = None)] #[command(author, version, about, long_about = None)]
struct Cli { struct Cli {

View file

@ -27,6 +27,7 @@ tokio = "1.28.0"
tracing = "0.1.40" tracing = "0.1.40"
tracing-indicatif = "0.3.6" tracing-indicatif = "0.3.6"
rustc-hash = "2.0.0" rustc-hash = "2.0.0"
mimalloc = "0.1.43"
[dependencies.wu-manber] [dependencies.wu-manber]
git = "https://github.com/tvlfyi/wu-manber.git" git = "https://github.com/tvlfyi/wu-manber.git"
@ -34,9 +35,6 @@ git = "https://github.com/tvlfyi/wu-manber.git"
[dev-dependencies] [dev-dependencies]
expect-test = "1.5.0" expect-test = "1.5.0"
[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5"
[features] [features]
default = [] default = []
tracy = ["tvix-tracing/tracy"] tracy = ["tvix-tracing/tracy"]

View file

@ -1,4 +1,5 @@
use clap::Parser; use clap::Parser;
use mimalloc::MiMalloc;
use std::rc::Rc; use std::rc::Rc;
use std::{fs, path::PathBuf}; use std::{fs, path::PathBuf};
use tvix_cli::args::Args; use tvix_cli::args::Args;
@ -7,12 +8,8 @@ use tvix_cli::{init_io_handle, interpret, AllowIncomplete};
use tvix_eval::observer::DisassemblingObserver; use tvix_eval::observer::DisassemblingObserver;
use tvix_glue::tvix_store_io::TvixStoreIO; use tvix_glue::tvix_store_io::TvixStoreIO;
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator] #[global_allocator]
static GLOBAL: Jemalloc = Jemalloc; static GLOBAL: MiMalloc = MiMalloc;
/// Interpret the given code snippet, but only run the Tvix compiler /// Interpret the given code snippet, but only run the Tvix compiler
/// on it and return errors and warnings. /// on it and return errors and warnings.

View file

@ -39,13 +39,11 @@ rustc-hash = "2.0.0"
[dev-dependencies] [dev-dependencies]
criterion = "0.5" criterion = "0.5"
itertools = "0.12.0" itertools = "0.12.0"
mimalloc = "0.1.43"
pretty_assertions = "1.2.1" pretty_assertions = "1.2.1"
rstest = "0.19.0" rstest = "0.19.0"
tempfile = "3.3.0" tempfile = "3.3.0"
[target.'cfg(not(target_env = "msvc"))'.dev-dependencies]
tikv-jemallocator = "0.5"
[features] [features]
default = ["impure", "arbitrary", "nix_tests"] default = ["impure", "arbitrary", "nix_tests"]

View file

@ -1,11 +1,9 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
use itertools::Itertools; use itertools::Itertools;
#[cfg(not(target_env = "msvc"))] use mimalloc::MiMalloc;
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator] #[global_allocator]
static GLOBAL: Jemalloc = Jemalloc; static GLOBAL: MiMalloc = MiMalloc;
fn interpret(code: &str) { fn interpret(code: &str) {
tvix_eval::Evaluation::builder_pure() tvix_eval::Evaluation::builder_pure()

View file

@ -36,13 +36,11 @@ clap = { version = "4.4.0", default-features = false }
[dependencies.wu-manber] [dependencies.wu-manber]
git = "https://github.com/tvlfyi/wu-manber.git" git = "https://github.com/tvlfyi/wu-manber.git"
[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5"
[dev-dependencies] [dev-dependencies]
criterion = { version = "0.5", features = ["html_reports"] } criterion = { version = "0.5", features = ["html_reports"] }
hex-literal = "0.4.1" hex-literal = "0.4.1"
lazy_static = "1.4.0" lazy_static = "1.4.0"
mimalloc = "0.1.43"
nix = { version = "0.27.1", features = [ "fs" ] } nix = { version = "0.27.1", features = [ "fs" ] }
pretty_assertions = "1.4.0" pretty_assertions = "1.4.0"
rstest = "0.19.0" rstest = "0.19.0"

View file

@ -1,9 +1,8 @@
use clap::Parser; use clap::Parser;
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use mimalloc::MiMalloc;
use std::{env, rc::Rc, sync::Arc, time::Duration}; use std::{env, rc::Rc, sync::Arc, time::Duration};
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
use tvix_build::buildservice::DummyBuildService; use tvix_build::buildservice::DummyBuildService;
use tvix_eval::{builtins::impure_builtins, EvalIO}; use tvix_eval::{builtins::impure_builtins, EvalIO};
use tvix_glue::{ use tvix_glue::{
@ -14,9 +13,8 @@ use tvix_glue::{
}; };
use tvix_store::utils::{construct_services, ServiceUrlsMemory}; use tvix_store::utils::{construct_services, ServiceUrlsMemory};
#[cfg(not(target_env = "msvc"))]
#[global_allocator] #[global_allocator]
static GLOBAL: Jemalloc = Jemalloc; static GLOBAL: MiMalloc = MiMalloc;
lazy_static! { lazy_static! {
static ref TOKIO_RUNTIME: tokio::runtime::Runtime = tokio::runtime::Runtime::new().unwrap(); static ref TOKIO_RUNTIME: tokio::runtime::Runtime = tokio::runtime::Runtime::new().unwrap();

View file

@ -28,6 +28,7 @@ url = "2.4.0"
serde = { version = "1.0.204", features = ["derive"] } serde = { version = "1.0.204", features = ["derive"] }
lru = "0.12.3" lru = "0.12.3"
parking_lot = "0.12.3" parking_lot = "0.12.3"
mimalloc = "0.1.43"
[build-dependencies] [build-dependencies]
prost-build = "0.13.1" prost-build = "0.13.1"

View file

@ -1,10 +1,14 @@
use clap::Parser; use clap::Parser;
use mimalloc::MiMalloc;
use nar_bridge::AppState; use nar_bridge::AppState;
use tower::ServiceBuilder; use tower::ServiceBuilder;
use tower_http::trace::{DefaultMakeSpan, TraceLayer}; use tower_http::trace::{DefaultMakeSpan, TraceLayer};
use tracing::info; use tracing::info;
use tvix_store::utils::ServiceUrlsGrpc; use tvix_store::utils::ServiceUrlsGrpc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
/// Expose the Nix HTTP Binary Cache protocol for a tvix-store. /// Expose the Nix HTTP Binary Cache protocol for a tvix-store.
#[derive(Parser)] #[derive(Parser)]
#[command(author, version, about, long_about = None)] #[command(author, version, about, long_about = None)]

View file

@ -20,6 +20,7 @@ ed25519 = "2.2.3"
ed25519-dalek = "2.1.0" ed25519-dalek = "2.1.0"
enum-primitive-derive = "0.3.0" enum-primitive-derive = "0.3.0"
glob = "0.3.0" glob = "0.3.0"
mimalloc = "0.1.43"
nom = "7.1.3" nom = "7.1.3"
num-traits = "0.2.18" num-traits = "0.2.18"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
@ -41,6 +42,7 @@ criterion = { version = "0.5", features = ["html_reports"] }
futures = { version = "0.3.30", default-features = false, features = ["executor"] } futures = { version = "0.3.30", default-features = false, features = ["executor"] }
hex-literal = "0.4.1" hex-literal = "0.4.1"
lazy_static = "1.4.0" lazy_static = "1.4.0"
mimalloc = "0.1.43"
pretty_assertions = "1.4.0" pretty_assertions = "1.4.0"
rstest = "0.19.0" rstest = "0.19.0"
serde_json = "1.0" serde_json = "1.0"

View file

@ -1,8 +1,12 @@
use std::path::Path; use std::path::Path;
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use criterion::{black_box, criterion_group, criterion_main, Criterion};
use mimalloc::MiMalloc;
use nix_compat::derivation::Derivation; use nix_compat::derivation::Derivation;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
const RESOURCES_PATHS: &str = "src/derivation/tests/derivation_tests/ok"; const RESOURCES_PATHS: &str = "src/derivation/tests/derivation_tests/ok";
fn bench_aterm_parser(c: &mut Criterion) { fn bench_aterm_parser(c: &mut Criterion) {

View file

@ -1,8 +1,12 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput}; use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use mimalloc::MiMalloc;
use nix_compat::narinfo::NarInfo; use nix_compat::narinfo::NarInfo;
use std::{io, str}; use std::{io, str};
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
const SAMPLE: &str = r#"StorePath: /nix/store/1pajsq519irjy86vli20bgq1wr1q3pny-banking-0.3.0 const SAMPLE: &str = r#"StorePath: /nix/store/1pajsq519irjy86vli20bgq1wr1q3pny-banking-0.3.0
URL: nar/0rdn027rxqbl42bv9jxhsipgq2hwqdapvwmdzligmzdmz2p9vybs.nar.xz URL: nar/0rdn027rxqbl42bv9jxhsipgq2hwqdapvwmdzligmzdmz2p9vybs.nar.xz
Compression: xz Compression: xz

View file

@ -3,6 +3,11 @@ use std::{collections::BTreeMap, io::Read};
use nix_compat::derivation::Derivation; use nix_compat::derivation::Derivation;
use serde_json::json; use serde_json::json;
use mimalloc::MiMalloc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
/// construct a serde_json::Value from a Derivation. /// construct a serde_json::Value from a Derivation.
/// Some environment values can be non-valid UTF-8 strings. /// Some environment values can be non-valid UTF-8 strings.
/// `serde_json` prints them out really unreadable. /// `serde_json` prints them out really unreadable.

View file

@ -46,6 +46,7 @@ hyper-util = "0.1.6"
toml = { version = "0.8.15", optional = true } toml = { version = "0.8.15", optional = true }
tonic-health = { version = "0.12.1", default-features = false } tonic-health = { version = "0.12.1", default-features = false }
redb = "2.1.1" redb = "2.1.1"
mimalloc = "0.1.43"
[dependencies.tonic-reflection] [dependencies.tonic-reflection]
optional = true optional = true

View file

@ -42,6 +42,11 @@ use tvix_castore::proto::FILE_DESCRIPTOR_SET as CASTORE_FILE_DESCRIPTOR_SET;
#[cfg(feature = "tonic-reflection")] #[cfg(feature = "tonic-reflection")]
use tvix_store::proto::FILE_DESCRIPTOR_SET; use tvix_store::proto::FILE_DESCRIPTOR_SET;
use mimalloc::MiMalloc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[derive(Parser)] #[derive(Parser)]
#[command(author, version, about, long_about = None)] #[command(author, version, about, long_about = None)]
struct Cli { struct Cli {