forked from mjhubisz/argweaver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MISC: use 1.76 (stable) instead of nightly
- Loading branch information
Showing
5 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use std::os::unix::ffi::OsStrExt; | ||
|
||
use argweavers::{ffi, sites::Sites}; | ||
use autocxx::prelude::*; | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
|
||
fn ffi_read_sites() { | ||
let mut s = ffi::Sites::new("", c_int(0), c_int(0)).within_unique_ptr(); | ||
let path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); | ||
let _ok = unsafe { | ||
ffi::read_sites1( | ||
path.join("examples/sim1/sim1.sites") | ||
.as_mut_os_string() | ||
.as_bytes() | ||
.as_ptr() as *const i8, | ||
std::pin::Pin::<&mut ffi::Sites>::into_inner_unchecked(s.pin_mut()), | ||
c_int(-1), | ||
c_int(-1), | ||
false, | ||
) | ||
}; | ||
} | ||
|
||
fn read_sites() { | ||
let path = std::path::PathBuf::from("examples/sim1/sim1.sites"); | ||
let _sites = Sites::from_path(path).unwrap(); | ||
} | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("read_sites"); | ||
group.bench_function("ffi_read_sites", |b| b.iter(ffi_read_sites)); | ||
group.bench_function("read_sites", |b| b.iter(read_sites)); | ||
group.finish(); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[toolchain] | ||
channel = "nightly" | ||
channel = "1.76" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#![feature(test)] | ||
#[cfg(feature = "extension-module")] | ||
use pyo3::prelude::*; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters