perf!: store HitObjectKind::Slider fields in Box (#26)
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
- __Breaking adjustments:__
|
- __Breaking adjustments:__
|
||||||
- Removed the method `HitObject::end_time` from the public api.
|
- Removed the method `HitObject::end_time` from the public api.
|
||||||
|
- The fields `control_points` and `edge_sounds` of `HitObjectKind::Slider` are now stored in a `Box` rather than a `Vec`.
|
||||||
- Overhauled gradual calculation. All relevant types are now gated behind the `gradual` feature which must be enabled.
|
- Overhauled gradual calculation. All relevant types are now gated behind the `gradual` feature which must be enabled.
|
||||||
- `*GradualDifficultyAttributes` has been renamed to `*GradualDifficulty` and `*GradualPerformanceAttributes`
|
- `*GradualDifficultyAttributes` has been renamed to `*GradualDifficulty` and `*GradualPerformanceAttributes`
|
||||||
has been renamed to `*GradualPerformance`.
|
has been renamed to `*GradualPerformance`.
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ pub enum HitObjectKind {
|
|||||||
/// The amount of repeat points of the slider.
|
/// The amount of repeat points of the slider.
|
||||||
repeats: usize,
|
repeats: usize,
|
||||||
/// The control points of the slider.
|
/// The control points of the slider.
|
||||||
control_points: Vec<PathControlPoint>,
|
control_points: Box<[PathControlPoint]>,
|
||||||
/// Sample sounds for the slider head, end, and repeat points.
|
/// Sample sounds for the slider head, end, and repeat points.
|
||||||
/// Required for converts.
|
/// Required for converts.
|
||||||
edge_sounds: Vec<u8>,
|
edge_sounds: Box<[u8]>,
|
||||||
},
|
},
|
||||||
/// A spinner object.
|
/// A spinner object.
|
||||||
Spinner {
|
Spinner {
|
||||||
|
|||||||
+5
-5
@@ -395,8 +395,9 @@ macro_rules! parse_hitobjects_body {
|
|||||||
// the actual `&str` elements transmuted into `(usize, usize)`.
|
// the actual `&str` elements transmuted into `(usize, usize)`.
|
||||||
let mut point_split_raw: Vec<(usize, usize)> = Vec::new();
|
let mut point_split_raw: Vec<(usize, usize)> = Vec::new();
|
||||||
|
|
||||||
// Buffer to re-use for all sliders
|
// Buffers to re-use for all sliders
|
||||||
let mut vertices = Vec::new();
|
let mut vertices = Vec::new();
|
||||||
|
let mut control_points = Vec::new();
|
||||||
|
|
||||||
'next_line: while next_line!($reader)? != 0 {
|
'next_line: while next_line!($reader)? != 0 {
|
||||||
if let Some(bytes) = $reader.get_section() {
|
if let Some(bytes) = $reader.get_section() {
|
||||||
@@ -482,8 +483,7 @@ macro_rules! parse_hitobjects_body {
|
|||||||
} else if kind & Self::SLIDER_FLAG > 0 {
|
} else if kind & Self::SLIDER_FLAG > 0 {
|
||||||
$self.n_sliders += 1;
|
$self.n_sliders += 1;
|
||||||
|
|
||||||
// Control Points: [1, 94872] | Median=3 | Mean=2.9984
|
control_points.clear();
|
||||||
let mut control_points = Vec::with_capacity(3);
|
|
||||||
|
|
||||||
let control_point_iter = match split.next() {
|
let control_point_iter = match split.next() {
|
||||||
Some(s) => s.split('|'),
|
Some(s) => s.split('|'),
|
||||||
@@ -569,7 +569,7 @@ macro_rules! parse_hitobjects_body {
|
|||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut edge_sounds = vec![sound; repeats + 2];
|
let mut edge_sounds = vec![sound; repeats + 2].into_boxed_slice();
|
||||||
|
|
||||||
split
|
split
|
||||||
.next()
|
.next()
|
||||||
@@ -590,7 +590,7 @@ macro_rules! parse_hitobjects_body {
|
|||||||
HitObjectKind::Slider {
|
HitObjectKind::Slider {
|
||||||
repeats,
|
repeats,
|
||||||
pixel_len,
|
pixel_len,
|
||||||
control_points,
|
control_points: Box::from(control_points.as_slice()),
|
||||||
edge_sounds,
|
edge_sounds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user