Merge pull request #45 from MaxOhn/raw_strains

refactor!: from compact_strains feat to raw_strains
This commit is contained in:
Badewanne3
2024-11-18 16:42:42 +01:00
committed by GitHub
5 changed files with 21 additions and 20 deletions
+4 -3
View File
@@ -26,7 +26,7 @@ jobs:
run: >
cargo test
--doc
--no-default-features --features compact_strains
--no-default-features
default:
name: Default tests
@@ -48,7 +48,7 @@ jobs:
- name: Run all tests
run: >
cargo nextest run
--no-default-features --features compact_strains
--no-default-features
--no-fail-fast --failure-output=immediate-final
sync:
@@ -77,7 +77,7 @@ jobs:
--no-fail-fast --failure-output=immediate-final
non_compact:
name: Test without compact_strains feature
name: Test with raw_strains feature
runs-on: ubuntu-latest
steps:
@@ -97,5 +97,6 @@ jobs:
run: >
cargo nextest run
--no-default-features
--features raw_strains
--test '*'
--no-fail-fast --failure-output=immediate-final
+2 -2
View File
@@ -11,8 +11,8 @@ description = "Difficulty and performance calculation for osu!"
keywords = ["osu", "pp", "stars", "performance", "difficulty"]
[features]
default = ["compact_strains"]
compact_strains = []
default = []
raw_strains = []
sync = []
tracing = ["rosu-map/tracing"]
+6 -6
View File
@@ -121,12 +121,12 @@ Calculating performances: Median: 44.13µs | Mean: 45.53µs
### Features
| Flag | Description | Dependencies
| ----------------- | ------------------------------------- | ------------
| `default` | Enables the `compact_strains` feature |
| `compact_strains` | Storing internal strain values in a plain Vec introduces an out-of-memory risk on maliciously long maps (see [/b/3739922](https://osu.ppy.sh/b/3739922)). This feature stores strains more compactly, but comes with a ~5% loss in performance. |
| `sync` | Some gradual calculation types can only be shared across threads if this feature is enabled. This adds a performance penalty so only enable this if really needed. |
| `tracing` | Any error encountered during beatmap decoding will be logged through `tracing::error`. If this feature is **not** enabled, errors will be ignored. | [`tracing`]
| Flag | Description | Dependencies
| ------------- | ------------------- | ------------
| `default` | No features enabled |
| `raw_strains` | With this feature, internal strain values will be stored in a plain `Vec`. This introduces an out-of-memory risk on maliciously long maps (see [/b/3739922](https://osu.ppy.sh/b/3739922)), but comes with a ~5% gain in performance. |
| `sync` | Some gradual calculation types can only be shared across threads if this feature is enabled. This feature adds a small performance penalty. |
| `tracing` | Any error encountered during beatmap decoding will be logged through `tracing::error`. If this feature is **not** enabled, errors will be ignored. | [`tracing`]
### Bindings
+6 -6
View File
@@ -117,12 +117,12 @@
//!
//! ## Features
//!
//! | Flag | Description | Dependencies
//! | ----------------- | ------------------------------------- | ------------
//! | `default` | Enables the `compact_strains` feature |
//! | `compact_strains` | Storing internal strain values in a plain Vec introduces an out-of-memory risk on maliciously long maps (see [/b/3739922](https://osu.ppy.sh/b/3739922)). This feature stores strains more compactly, but comes with a ~5% loss in performance. |
//! | `sync` | Some gradual calculation types can only be shared across threads if this feature is enabled. This adds a performance penalty so only enable this if really needed. |
//! | `tracing` | Any error encountered during beatmap decoding will be logged through `tracing::error`. If this feature is **not** enabled, errors will be ignored. | [`tracing`]
//! | Flag | Description | Dependencies
//! | ------------- | ------------------- | ------------
//! | `default` | No features enabled |
//! | `raw_strains` | With this feature, internal strain values will be stored in a plain `Vec`. This introduces an out-of-memory risk on maliciously long maps (see [/b/3739922](https://osu.ppy.sh/b/3739922)), but comes with a ~5% gain in performance. |
//! | `sync` | Some gradual calculation types can only be shared across threads if this feature is enabled. This feature adds a small performance penalty. |
//! | `tracing` | Any error encountered during beatmap decoding will be logged through `tracing::error`. If this feature is **not** enabled, errors will be ignored. | [`tracing`]
//!
//! ## Bindings
//!
+3 -3
View File
@@ -1,6 +1,6 @@
pub use inner::*;
#[cfg(feature = "compact_strains")]
#[cfg(not(feature = "raw_strains"))]
mod inner {
use std::{iter::Copied, slice::Iter};
@@ -318,14 +318,14 @@ mod inner {
}
}
#[cfg(not(feature = "compact_strains"))]
#[cfg(feature = "raw_strains")]
mod inner {
use std::{
iter::Copied,
slice::{Iter, IterMut},
};
/// Plain wrapper around `Vec<f64>` because the `compact_strains` feature
/// Plain wrapper around `Vec<f64>` because the `raw_strains` feature
/// is disabled.
#[derive(Clone)]
pub struct StrainsVec {