From a5d9312ef3fbcc53af116bfa9f229254e423eaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Na=C5=9Bciszewski?= Date: Fri, 1 Sep 2017 15:04:56 -0500 Subject: [PATCH] servo: Merge #18272 - Correct "is sorted" check in profile statistics (from mateon1:fix/profile-sorted-assert); r=emilio 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")) ``` --- - [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). - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ 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 --- servo/components/profile/time.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servo/components/profile/time.rs b/servo/components/profile/time.rs index 16495b63d43a..2eb48f57a133 100644 --- a/servo/components/profile/time.rs +++ b/servo/components/profile/time.rs @@ -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 });