Skip to content

Commit

Permalink
fix: address overhead of deserializing the stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwalker committed Aug 17, 2024
1 parent d762ace commit 994d084
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,6 @@ opt-level = 3

[profile.dev.package.onig]
opt-level = 3

[profile.dev.package.miden-crypto]
opt-level = 3
1 change: 1 addition & 0 deletions midenc-session/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(debug_closure_helpers)]
#![feature(lazy_cell)]
extern crate alloc;

pub mod diagnostics;
Expand Down
8 changes: 6 additions & 2 deletions midenc-session/src/libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{
ffi::OsStr,
path::{Path, PathBuf},
str::FromStr,
sync::LazyLock,
};

use miden_assembly::{Library as CompiledLibrary, LibraryNamespace};
Expand All @@ -14,6 +15,9 @@ use crate::{
Session,
};

static STDLIB: LazyLock<StdLibrary> = LazyLock::new(StdLibrary::default);
static BASE: LazyLock<MidenTxKernelLibrary> = LazyLock::new(MidenTxKernelLibrary::default);

/// The types of libraries that can be linked against during compilation
#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(
Expand Down Expand Up @@ -72,8 +76,8 @@ impl LinkLibrary {

// Handle libraries shipped with the compiler, or via Miden crates
match self.name.as_ref() {
"std" => return Ok(StdLibrary::default().into()),
"base" => return Ok(MidenTxKernelLibrary::default().into()),
"std" => return Ok((*STDLIB).as_ref().clone()),
"base" => return Ok((*BASE).as_ref().clone()),
_ => (),
}

Expand Down

0 comments on commit 994d084

Please sign in to comment.