Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Rust-Python inter-op cost significantly #174

Merged
merged 4 commits into from
Feb 21, 2023
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
- id: cargo-clippy-fix
name: cargo clippy fix
language: rust
entry: cargo clippy --manifest-path=light-curve/Cargo.toml --all-targets --fix --allow-dirty
entry: cargo clippy --manifest-path=light-curve/Cargo.toml --all-targets --fix --allow-dirty --allow-staged
files: \.rs
pass_filenames: false
- id: cargo-clippy-check
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

--
- Reduce Rust-Python inter-op cost for numpy arrays significantly. It dropped from ~4 μs per array to ~100ns. https://github.com/light-curve/light-curve-python/pull/174

### Security

Expand Down
8 changes: 4 additions & 4 deletions light-curve/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use itertools::Itertools;
use light_curve_feature::Float;
use ndarray::{ArrayView1, Zip};

pub fn is_sorted<T>(a: &[T]) -> bool
pub(crate) fn is_sorted<T>(a: &[T]) -> bool
where
T: PartialOrd,
{
a.iter().tuple_windows().all(|(a, b)| a < b)
}

pub fn check_sorted<T>(a: &[T], sorted: Option<bool>) -> Res<()>
pub(crate) fn check_sorted<T>(a: &[T], sorted: Option<bool>) -> Res<()>
where
T: PartialOrd,
{
Expand All @@ -32,7 +32,7 @@ where
}
}

pub fn check_finite<T>(a: ArrayView1<'_, T>) -> Res<()>
pub(crate) fn check_finite<T>(a: ArrayView1<'_, T>) -> Res<()>
where
T: Float,
{
Expand All @@ -45,7 +45,7 @@ where
}
}

pub fn check_no_nans<T>(a: ArrayView1<'_, T>) -> Res<()>
pub(crate) fn check_no_nans<T>(a: ArrayView1<'_, T>) -> Res<()>
where
T: Float,
{
Expand Down
Loading