mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
servo: Merge #18272 - Correct "is sorted" check in profile statistics (from mateon1:fix/profile-sorted-assert); r=emilio
<!-- Please describe your changes on the following line: --> Correct the debug_assert check for whether or not statistics collected by the --profile flag are sorted. I'm not sure how I could add a test for this change, and whether that is necessary. I also wonder if it makes sense to replace the sort_by calls (currently using explicit comparisons) in this file with something like ``` data.sort_by(|a, b| a.partial_cmp(b).expect("no NaN in collected statistics")) ``` --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #18270 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 2550b47decbc9876d96a459e399658ca54998bda --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : df9342b1e4cd360292fb3acb63192eeef209064c
This commit is contained in:
parent
01f7b09540
commit
a5d9312ef3
@ -328,7 +328,7 @@ impl Profiler {
|
||||
/// Get tuple (mean, median, min, max) for profiler statistics.
|
||||
pub fn get_statistics(data: &[f64]) -> (f64, f64, f64, f64) {
|
||||
data.iter().fold(-f64::INFINITY, |a, &b| {
|
||||
debug_assert!(a < b, "Data must be sorted");
|
||||
debug_assert!(a <= b, "Data must be sorted");
|
||||
b
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user