Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ ends in `.bz2`, the function will compress first with bz2.
In `tests.rs`, integration tests for reading and writing all file types are present. Small example files
are contained in `tests/test_files`.

### `benches/io_benchmarking.rs`
This file contains benchmarking functions for checking the performance of the basic read functions.
### `benches/bench.rs`
This file contains benchmarking functions for checking the performance of the basic read functions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "darn-dmap"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
rust-version = "1.63.0"
authors = ["Remington Rohel"]
description = "SuperDARN DMAP file format I/O"
repository = "https://github.com/SuperDARNCanada/dmap"
license = "LGPL-3.0-or-later"
keywords = ["SuperDARN", "dmap", "I/O"]
keywords = ["SuperDARN"]
categories = ["parser-implementations", "science"]
include = ["src/**/*.rs"]

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

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

[[bench]]
name = "io_benchmarking"
name = "bench"
harness = false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
A library for SuperDARN DMAP file I/O
=====================================

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

[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
[crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
Expand Down
79 changes: 79 additions & 0 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
use criterion::{criterion_group, criterion_main, Criterion};
use dmap::formats::dmap::DmapRecord;
use dmap::formats::fitacf::FitacfRecord;
use dmap::formats::grid::GridRecord;
use dmap::formats::iqdat::IqdatRecord;
use dmap::formats::map::MapRecord;
use dmap::formats::rawacf::RawacfRecord;
use dmap::formats::snd::SndRecord;
use dmap::record::Record;
use dmap::types::DmapField;
use indexmap::IndexMap;
use paste::paste;

fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("Read IQDAT", |b| b.iter(|| read_iqdat()));
c.bench_function("Read RAWACF", |b| b.iter(|| read_rawacf()));
c.bench_function("Read FITACF", |b| b.iter(|| read_fitacf()));
c.bench_function("Read GRID", |b| b.iter(|| read_grid()));
c.bench_function("Read SND", |b| b.iter(|| read_snd()));
c.bench_function("Read MAP", |b| b.iter(|| read_map()));
c.bench_function("Read DMAP", |b| b.iter(|| read_dmap()));

c.bench_function("Read bzipped IQDAT", |b| b.iter(|| read_iqdat_bz2()));
c.bench_function("Read bzipped RAWACF", |b| b.iter(|| read_rawacf_bz2()));
c.bench_function("Read bzipped FITACF", |b| b.iter(|| read_fitacf_bz2()));
c.bench_function("Read bzipped GRID", |b| b.iter(|| read_grid_bz2()));
c.bench_function("Read bzipped SND", |b| b.iter(|| read_snd_bz2()));
c.bench_function("Read bzipped MAP", |b| b.iter(|| read_map_bz2()));
c.bench_function("Read bzipped DMAP", |b| b.iter(|| read_dmap_bz2()));

c.bench_function("Read IQDAT metadata", |b| b.iter(|| read_iqdat_metadata()));
c.bench_function("Read RAWACF metadata", |b| b.iter(|| read_rawacf_metadata()));
c.bench_function("Read FITACF metadata", |b| b.iter(|| read_fitacf_metadata()));
c.bench_function("Read GRID metadata", |b| b.iter(|| read_grid_metadata()));
c.bench_function("Read SND metadata", |b| b.iter(|| read_snd_metadata()));
c.bench_function("Read MAP metadata", |b| b.iter(|| read_map_metadata()));
c.bench_function("Read DMAP metadata", |b| b.iter(|| read_dmap_metadata()));

// let records = read_iqdat();
// c.bench_with_input(
// BenchmarkId::new("Write IQDAT", "IQDAT Records"),
// &records,
// |b, s| b.iter(|| write_iqdat(s)),
// );
}

/// Generates benchmark functions for a given DMAP record type.
macro_rules! read_type {
($type:ident, $name:literal) => {
paste! {
fn [< read_ $type >]() -> Vec<[< $type:camel Record >]> {
[< $type:camel Record >]::read_file(format!("tests/test_files/test.{}", $name)).unwrap()
}

fn [< read_ $type _bz2 >]() -> Vec<[< $type:camel Record >]> {
[< $type:camel Record >]::read_file(format!("tests/test_files/test.{}.bz2", $name)).unwrap()
}

fn [< read_ $type _metadata >]() -> Vec<IndexMap<String, DmapField>> {
[< $type:camel Record >]::read_file_metadata(format!("tests/test_files/test.{}", $name)).unwrap()
}
}
}
}

read_type!(iqdat, "iqdat");
read_type!(rawacf, "rawacf");
read_type!(fitacf, "fitacf");
read_type!(grid, "grid");
read_type!(map, "map");
read_type!(snd, "snd");
read_type!(dmap, "rawacf");

criterion_group! {
name = benches;
config = Criterion::default();
targets = criterion_benchmark
}
criterion_main!(benches);
58 changes: 0 additions & 58 deletions benches/io_benchmarking.rs

This file was deleted.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "darn-dmap"
version = "0.5.0"
version = "0.6.0"
requires-python = ">=3.8"
authors = [
{ name = "Remington Rohel" }
Expand Down Expand Up @@ -34,4 +34,4 @@ strip = true
dev = [
"pytest",
"ruff",
]
]
Loading
Loading