Skip to content

Commit dd317c6

Browse files
Merge pull request #30 from SuperDARNCanada/develop
Release: v0.6.0
2 parents 10f98d2 + 14861c1 commit dd317c6

File tree

20 files changed

+581
-120
lines changed

20 files changed

+581
-120
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ ends in `.bz2`, the function will compress first with bz2.
4646
In `tests.rs`, integration tests for reading and writing all file types are present. Small example files
4747
are contained in `tests/test_files`.
4848

49-
### `benches/io_benchmarking.rs`
50-
This file contains benchmarking functions for checking the performance of the basic read functions.
49+
### `benches/bench.rs`
50+
This file contains benchmarking functions for checking the performance of the basic read functions.

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[package]
22
name = "darn-dmap"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
edition = "2021"
55
rust-version = "1.63.0"
66
authors = ["Remington Rohel"]
77
description = "SuperDARN DMAP file format I/O"
88
repository = "https://github.com/SuperDARNCanada/dmap"
99
license = "LGPL-3.0-or-later"
10-
keywords = ["SuperDARN", "dmap", "I/O"]
10+
keywords = ["SuperDARN"]
1111
categories = ["parser-implementations", "science"]
12+
include = ["src/**/*.rs"]
1213

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

@@ -34,5 +35,5 @@ paste = "1.0.15"
3435
criterion = { version = "0.4", features = ["html_reports"] }
3536

3637
[[bench]]
37-
name = "io_benchmarking"
38+
name = "bench"
3839
harness = false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
A library for SuperDARN DMAP file I/O
22
=====================================
33

4-
[![github]](https://github.com/SuperDARNCanada/dmap) [![crates-io]](https://crates.io/crates/darn-dmap) [![docs-rs]](crate)
4+
[![github]](https://github.com/SuperDARNCanada/dmap) [![crates-io]](https://crates.io/crates/darn-dmap) [![docs-rs]](https://docs.rs/darn-dmap)
55

66
[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
77
[crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust

benches/bench.rs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
use criterion::{criterion_group, criterion_main, Criterion};
2+
use dmap::formats::dmap::DmapRecord;
3+
use dmap::formats::fitacf::FitacfRecord;
4+
use dmap::formats::grid::GridRecord;
5+
use dmap::formats::iqdat::IqdatRecord;
6+
use dmap::formats::map::MapRecord;
7+
use dmap::formats::rawacf::RawacfRecord;
8+
use dmap::formats::snd::SndRecord;
9+
use dmap::record::Record;
10+
use dmap::types::DmapField;
11+
use indexmap::IndexMap;
12+
use paste::paste;
13+
14+
fn criterion_benchmark(c: &mut Criterion) {
15+
c.bench_function("Read IQDAT", |b| b.iter(|| read_iqdat()));
16+
c.bench_function("Read RAWACF", |b| b.iter(|| read_rawacf()));
17+
c.bench_function("Read FITACF", |b| b.iter(|| read_fitacf()));
18+
c.bench_function("Read GRID", |b| b.iter(|| read_grid()));
19+
c.bench_function("Read SND", |b| b.iter(|| read_snd()));
20+
c.bench_function("Read MAP", |b| b.iter(|| read_map()));
21+
c.bench_function("Read DMAP", |b| b.iter(|| read_dmap()));
22+
23+
c.bench_function("Read bzipped IQDAT", |b| b.iter(|| read_iqdat_bz2()));
24+
c.bench_function("Read bzipped RAWACF", |b| b.iter(|| read_rawacf_bz2()));
25+
c.bench_function("Read bzipped FITACF", |b| b.iter(|| read_fitacf_bz2()));
26+
c.bench_function("Read bzipped GRID", |b| b.iter(|| read_grid_bz2()));
27+
c.bench_function("Read bzipped SND", |b| b.iter(|| read_snd_bz2()));
28+
c.bench_function("Read bzipped MAP", |b| b.iter(|| read_map_bz2()));
29+
c.bench_function("Read bzipped DMAP", |b| b.iter(|| read_dmap_bz2()));
30+
31+
c.bench_function("Read IQDAT metadata", |b| b.iter(|| read_iqdat_metadata()));
32+
c.bench_function("Read RAWACF metadata", |b| b.iter(|| read_rawacf_metadata()));
33+
c.bench_function("Read FITACF metadata", |b| b.iter(|| read_fitacf_metadata()));
34+
c.bench_function("Read GRID metadata", |b| b.iter(|| read_grid_metadata()));
35+
c.bench_function("Read SND metadata", |b| b.iter(|| read_snd_metadata()));
36+
c.bench_function("Read MAP metadata", |b| b.iter(|| read_map_metadata()));
37+
c.bench_function("Read DMAP metadata", |b| b.iter(|| read_dmap_metadata()));
38+
39+
// let records = read_iqdat();
40+
// c.bench_with_input(
41+
// BenchmarkId::new("Write IQDAT", "IQDAT Records"),
42+
// &records,
43+
// |b, s| b.iter(|| write_iqdat(s)),
44+
// );
45+
}
46+
47+
/// Generates benchmark functions for a given DMAP record type.
48+
macro_rules! read_type {
49+
($type:ident, $name:literal) => {
50+
paste! {
51+
fn [< read_ $type >]() -> Vec<[< $type:camel Record >]> {
52+
[< $type:camel Record >]::read_file(format!("tests/test_files/test.{}", $name)).unwrap()
53+
}
54+
55+
fn [< read_ $type _bz2 >]() -> Vec<[< $type:camel Record >]> {
56+
[< $type:camel Record >]::read_file(format!("tests/test_files/test.{}.bz2", $name)).unwrap()
57+
}
58+
59+
fn [< read_ $type _metadata >]() -> Vec<IndexMap<String, DmapField>> {
60+
[< $type:camel Record >]::read_file_metadata(format!("tests/test_files/test.{}", $name)).unwrap()
61+
}
62+
}
63+
}
64+
}
65+
66+
read_type!(iqdat, "iqdat");
67+
read_type!(rawacf, "rawacf");
68+
read_type!(fitacf, "fitacf");
69+
read_type!(grid, "grid");
70+
read_type!(map, "map");
71+
read_type!(snd, "snd");
72+
read_type!(dmap, "rawacf");
73+
74+
criterion_group! {
75+
name = benches;
76+
config = Criterion::default();
77+
targets = criterion_benchmark
78+
}
79+
criterion_main!(benches);

benches/io_benchmarking.rs

Lines changed: 0 additions & 58 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "darn-dmap"
7-
version = "0.5.0"
7+
version = "0.6.0"
88
requires-python = ">=3.8"
99
authors = [
1010
{ name = "Remington Rohel" }
@@ -34,4 +34,4 @@ strip = true
3434
dev = [
3535
"pytest",
3636
"ruff",
37-
]
37+
]

0 commit comments

Comments
 (0)