Skip to content

Commit

Permalink
Made benchmarking optional and removed some inlines.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragostis committed Sep 13, 2024
1 parent 7df2dce commit 9a9a0d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 227 deletions.
220 changes: 1 addition & 219 deletions Cargo.lock

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

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ name = "spice"
version = "0.1.0"
edition = "2021"

[dev-dependencies]
divan = "0.1.14"
[features]
bench = ["dep:divan", "dep:rayon"]

[dependencies]
divan = { version = "0.1.14", optional = true }
rayon = { version = "1.10.0", optional = true }

[[bench]]
name = "overhead"
harness = false

[dependencies]
no_deadlocks = "1.3.2"
rayon = "1.10.0"
required-features = ["bench"]
2 changes: 0 additions & 2 deletions benches/overhead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ fn no_overhead(bencher: Bencher, nodes: (usize, usize)) {

#[divan::bench(args = nodes())]
fn overhead(bencher: Bencher, nodes: (usize, usize)) {
#[inline]
fn sum(node: &Node, scope: &mut Scope<'_>) -> u64 {
let (left, right) = scope.join(
|s| node.left.as_deref().map(|n| sum(n, s)).unwrap_or_default(),
Expand All @@ -77,7 +76,6 @@ fn overhead(bencher: Bencher, nodes: (usize, usize)) {

#[divan::bench(args = nodes())]
fn rayon_overhead(bencher: Bencher, nodes: (usize, usize)) {
#[inline]
fn sum(node: &Node) -> u64 {
let (left, right) = rayon::join(
|| node.left.as_deref().map(sum).unwrap_or_default(),
Expand Down

0 comments on commit 9a9a0d1

Please sign in to comment.