Skip to content

Commit c9dc26e

Browse files
committed
only run on profiler feature
1 parent 4348e35 commit c9dc26e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

boa/Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ license = "Unlicense/MIT"
1010
exclude = ["../.vscode/*", "../Dockerfile", "../Makefile", "../.editorConfig"]
1111
edition = "2018"
1212

13+
[features]
14+
profiler = ["measureme", "once_cell"]
15+
1316
[dependencies]
1417
gc = { version = "0.3.5", features = ["derive"] }
1518
serde_json = "1.0.53"
@@ -21,9 +24,9 @@ num-bigint = { version = "0.2.6", features = ["serde"] }
2124

2225
# Optional Dependencies
2326
serde = { version = "1.0.110", features = ["derive"], optional = true }
27+
measureme = { version = "0.7.1", optional = true }
28+
once_cell = { version = "1.4.0", optional = true }
2429
bitflags = "1.2.1"
25-
measureme = { version = "0.7.1" }
26-
once_cell = "1.4.0"
2730

2831
[dev-dependencies]
2932
criterion = "0.3.2"

boa/src/profiler.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#![allow(missing_copy_implementations, missing_debug_implementations)]
22

3+
#[cfg(feature = "profiler")]
34
use measureme::{EventId, Profiler, TimingGuard};
5+
#[cfg(feature = "profiler")]
46
use once_cell::sync::OnceCell;
57
use std::fmt::{self, Debug};
8+
#[cfg(feature = "profiler")]
69
use std::{
710
path::Path,
811
thread::{current, ThreadId},
@@ -11,14 +14,17 @@ use std::{
1114
/// MmapSerializatioSink is faster on macOS and Linux
1215
/// but FileSerializationSink is faster on Windows
1316
#[cfg(not(windows))]
17+
#[cfg(feature = "profiler")]
1418
type SerializationSink = measureme::MmapSerializationSink;
1519
#[cfg(windows)]
20+
#[cfg(feature = "profiler")]
1621
type SerializationSink = measureme::FileSerializationSink;
1722
#[cfg(feature = "profiler")]
1823
pub struct BoaProfiler {
1924
profiler: Profiler<SerializationSink>,
2025
}
2126

27+
#[cfg(feature = "profiler")]
2228
pub static mut INSTANCE: OnceCell<BoaProfiler> = OnceCell::new();
2329

2430
#[cfg(feature = "profiler")]

0 commit comments

Comments
 (0)