]> git.huck.website - metaforge.git/commitdiff
only dir benchmark
authorHuck Boles <huck@huck.website>
Tue, 16 May 2023 02:07:32 +0000 (21:07 -0500)
committerHuck Boles <huck@huck.website>
Tue, 16 May 2023 02:07:32 +0000 (21:07 -0500)
Cargo.toml
benches/file.rs [deleted file]

index ccaf54e1d576b5a5d5ba5dbae76790859740c338..4968c4fa3d8e19aeb4d1f13b366af5f993ab0873 100644 (file)
@@ -13,10 +13,6 @@ pest_derive = "2"
 [dev-dependencies]
 criterion = "0.4"
 
-[[bench]]
-name = "file"
-harness = false
-
 [[bench]]
 name = "dir"
 harness = false
diff --git a/benches/file.rs b/benches/file.rs
deleted file mode 100644 (file)
index e333ccd..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
-
-pub fn build_file_benchmark(c: &mut Criterion) {
-    let dir = std::path::PathBuf::from("files/benchmark_site")
-        .canonicalize()
-        .unwrap();
-
-    let mut opts = metaforge::Options::new();
-    opts.root = dir.clone();
-    opts.source = dir.join("source");
-    opts.build = dir.join("build");
-    opts.pattern = dir.join("pattern");
-    opts.clean = true;
-
-    let source = opts.source.join("benchmark.meta");
-
-    c.bench_function("build file", |b| {
-        b.iter(|| {
-            let string = std::fs::read_to_string(black_box(&source)).expect("read file");
-            let mut file = metaforge::parse_file(string, black_box(&opts)).expect("parse file");
-            file.path = black_box(source.clone());
-            let string = metaforge::build_metafile(&file).expect("build file");
-            std::fs::write(file.dest().expect("find dest"), string).expect("write file");
-        })
-    });
-}
-
-criterion_group! {
-    name = benches;
-    config = Criterion::default().sample_size(10);
-    targets = build_file_benchmark
-}
-
-criterion_main!(benches);