Skip to content

Commit

Permalink
move benchmarks to a subcrate
Browse files Browse the repository at this point in the history
this moves the jemallocator and criterion dependencies to that crate,
which will prevent further issues with MSRV in dependencies, and removes
75 dependencies from test builds
  • Loading branch information
Geal committed Oct 23, 2021
1 parent d15a266 commit 42102c5
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 37 deletions.
40 changes: 3 additions & 37 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,9 @@ version = "2.3"
default-features = false

[dev-dependencies]
criterion = "0.3"
doc-comment = "0.3"
proptest = "1.0.0"

[target.'cfg(not(all(target_os = "windows", target_env = "msvc")))'.dev-dependencies]
jemallocator = "^0.3"

[build-dependencies]
version_check = "0.9"

Expand All @@ -60,9 +56,6 @@ debug = true
lto = true
codegen-units = 1

[lib]
bench = false

[[test]]
name = "arithmetic"

Expand Down Expand Up @@ -115,36 +108,6 @@ name = "reborrow_fold"
name = "fnmut"
required-features = ["alloc"]

[[bench]]
name = "arithmetic"
path = "benches/arithmetic.rs"
harness = false

[[bench]]
name = "number"
path = "benches/number.rs"
harness = false

[[bench]]
name = "http"
path = "benches/http.rs"
harness = false

[[bench]]
name = "ini"
path = "benches/ini.rs"
harness = false

[[bench]]
name = "ini_str"
path = "benches/ini_str.rs"
harness = false

[[bench]]
name = "json"
path = "benches/json.rs"
harness = false

[[example]]
name = "json"
required-features = ["alloc"]
Expand All @@ -167,3 +130,6 @@ path = "examples/string.rs"
travis-ci = { repository = "Geal/nom" }
coveralls = { repository = "Geal/nom", branch = "master", service = "github" }
maintenance = { status = "actively-developed" }

[workspace]
members = [".", "benchmarks/"]
44 changes: 44 additions & 0 deletions benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "benchmarks"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
criterion = "0.3.5"
jemallocator = "0.3.2"
nom = { path = "../" }

[lib]
bench = false

[[bench]]
name = "arithmetic"
path = "benches/arithmetic.rs"
harness = false

[[bench]]
name = "number"
path = "benches/number.rs"
harness = false

[[bench]]
name = "http"
path = "benches/http.rs"
harness = false

[[bench]]
name = "ini"
path = "benches/ini.rs"
harness = false

[[bench]]
name = "ini_str"
path = "benches/ini_str.rs"
harness = false

[[bench]]
name = "json"
path = "benches/json.rs"
harness = false
1 change: 1 addition & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Benchmarks for nom parsers
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
}

0 comments on commit 42102c5

Please sign in to comment.