Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use mimalloc as the default allocator #7059

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ tracing = "0.1.40"
tracing-web = "0.1.3"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
rust-embed = "6.6.0"
mimalloc = "0.1"

[profile.dev]
# This is required to be able to run `cargo test` in acvm_js due to the `locals exceeds maximum` error.
Expand Down
24 changes: 24 additions & 0 deletions compiler/noirc_frontend/src/elaborator/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,30 @@ impl<'context> Elaborator<'context> {

let the_trait = self.interner.get_trait(constraint.trait_bound.trait_id);
if let Some(method) = the_trait.find_method(path.last_name()) {
let show = |constraint: &TraitConstraint| {
let name = &self.interner.get_trait(constraint.trait_bound.trait_id).name;
let args = vecmap(
&constraint.trait_bound.trait_generics.ordered,
ToString::to_string,
)
.join(", ");
let named = vecmap(&constraint.trait_bound.trait_generics.named, |t| {
format!("{}: {}", t.name, t.typ)
})
.join(", ");

if args.is_empty() && named.is_empty() {
name.to_string()
} else if args.is_empty() {
format!("{name}<{named}>")
} else if named.is_empty() {
format!("{name}<{args}>")
} else {
format!("{name}<{args}, {named}>")
}
};

eprintln!("Returning assumed constraint: {}", show(&constraint));
return Some(TraitPathResolution {
method: TraitMethod { method_id: method, constraint, assumed: true },
item: None,
Expand Down
1 change: 1 addition & 0 deletions tooling/acvm_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ nargo.workspace = true
const_format.workspace = true
bn254_blackbox_solver.workspace = true
acir.workspace = true
mimalloc.workspace = true

# Logs
tracing-subscriber.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions tooling/acvm_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use tracing_appender::rolling;
use tracing_subscriber::{fmt::format::FmtSpan, EnvFilter};

#[global_allocator]
static GLOBAL_ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;

Check warning on line 15 in tooling/acvm_cli/src/main.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (mimalloc)

Check warning on line 15 in tooling/acvm_cli/src/main.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (mimalloc)

fn main() {
// Setup tracing
if let Ok(log_dir) = env::var("ACVM_LOG_DIR") {
Expand Down
1 change: 1 addition & 0 deletions tooling/nargo_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ clap-markdown = { git = "https://github.com/noir-lang/clap-markdown", rev = "450
notify = "6.1.1"
notify-debouncer-full = "0.3.1"
termion = "3.0.0"
mimalloc.workspace = true

# Logs
tracing.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions tooling/nargo_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

const PANIC_MESSAGE: &str = "This is a bug. We may have already fixed this in newer versions of Nargo so try searching for similar issues at https://github.com/noir-lang/noir/issues/.\nIf there isn't an open issue for this bug, consider opening one at https://github.com/noir-lang/noir/issues/new?labels=bug&template=bug_report.yml";

#[global_allocator]
static GLOBAL_ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;

Check warning on line 23 in tooling/nargo_cli/src/main.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (mimalloc)

Check warning on line 23 in tooling/nargo_cli/src/main.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (mimalloc)

fn main() {
setup_tracing();

Expand Down
1 change: 1 addition & 0 deletions tooling/profiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ nargo.workspace = true
noirc_errors.workspace = true
noirc_abi.workspace = true
noirc_evaluator.workspace = true
mimalloc.workspace = true

# Logs
tracing-subscriber.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions tooling/profiler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use tracing_appender::rolling;
use tracing_subscriber::{fmt::format::FmtSpan, EnvFilter};

#[global_allocator]
static GLOBAL_ALLOCATOR: mimalloc::MiMalloc = mimalloc::MiMalloc;

Check warning on line 18 in tooling/profiler/src/main.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (mimalloc)

Check warning on line 18 in tooling/profiler/src/main.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (mimalloc)

fn main() {
// Setup tracing
if let Ok(log_dir) = env::var("PROFILER_LOG_DIR") {
Expand Down
Loading