diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22f39428..62ab0732 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 9f07f067..72667e4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/README.md b/README.md index 2994b404..0d32d848 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/lib.rs b/src/lib.rs index b54337c9..71b19a8e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 //! diff --git a/src/util/strains_vec.rs b/src/util/strains_vec.rs index 5fd844a5..c46495ef 100644 --- a/src/util/strains_vec.rs +++ b/src/util/strains_vec.rs @@ -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` because the `compact_strains` feature + /// Plain wrapper around `Vec` because the `raw_strains` feature /// is disabled. #[derive(Clone)] pub struct StrainsVec {