|
| 1 | +# Comparison Analysis |
| 2 | + |
| 3 | +The following is a detailed explanation of the process undertaken to automate the analysis of test results for two artifacts of interest (artifact A and B). |
| 4 | + |
| 5 | +This analysis can be done by hand, by using the [comparison page](https://perf.rust-lang.org/compare.html) and entering the two artifacts of interest in the form at the top. |
| 6 | + |
| 7 | +## The goal |
| 8 | + |
| 9 | +The goal of the analysis is to determine whether artifact B represents a performance improvement, regression, or mixed result from artifact A. Typically artifact B will be based on artifact A with a certain pull requests changes applied to artifact A to get artifact B, but this is not required. |
| 10 | + |
| 11 | +Performance analysis is typically used to determine whether a pull request has introduced performance regressions or improvements. |
| 12 | + |
| 13 | +## What is being compared? |
| 14 | + |
| 15 | +At the core of comparison analysis are the collection of test results for the two artifacts being compared. For each test case, the statistics for the two artifacts are compared and a relative change percentage is obtained using the following formula: |
| 16 | + |
| 17 | +``` |
| 18 | +100 * ((statisticForArtifactB - statisticForArtifactA) / statisticForArtifactA) |
| 19 | +``` |
| 20 | + |
| 21 | +## High-level analysis description |
| 22 | + |
| 23 | +Analysis of the changes is performed in order to determine whether artifact B represents a performance change over artifact A. At a high level the analysis performed takes the following form: |
| 24 | + |
| 25 | +Are there 1 or more _significant_ test results that indicate performance changes. If all significant test results indicate regressions (i.e., all percent relative changes are positive), then artifact B represents a performance regression over artifact A. If all significant test results indicate improvements (i.e., all percent relative changes are negative), then artifact B represents a performance improvement over artifact B. If some significant test results indicate improvement and others indicate regressions, then the performance change is mixed. |
| 26 | + |
| 27 | +* What makes a test result significant? |
| 28 | + |
| 29 | +A test result is significant if the relative change percentage meets some threshold. What the threshold is depends of whether the test case is "dodgy" or not (see below for an examination of "dodginess"). For dodgy test cases, the threshold is set at 1%. For non-dodgy test cases, the threshold is set to 0.1%. |
| 30 | + |
| 31 | +* What makes a test case "dodgy"? |
| 32 | + |
| 33 | +A test case is "dodgy" if it shows signs of either being noisy or highly variable. |
| 34 | + |
| 35 | +To determine noise and high variability, the previous 100 test results for the test case in question are examined by calculating relative delta changes between adjacent test results. This is done with the following formula (where `testResult1` is the test result immediately proceeding `testResult2`): |
| 36 | + |
| 37 | +``` |
| 38 | +testResult2 - testResult1 / testResult1 |
| 39 | +``` |
| 40 | + |
| 41 | +Any relative delta change that is above a threshold (currently 0.1) is considered "significant" for the purposes of dodginess detection. |
| 42 | + |
| 43 | +A highly variable test case is one where a certain percentage (currently 5%) of relative delta changes are significant. The logic being that test cases should only display significant relative delta changes a small percentage of the time. |
| 44 | + |
| 45 | +A noisy test case is one where of all the non-significant relative delta changes, the average delta change is still above some threshold (0.001). The logic being that non-significant changes should, on average, being very close to 0. If they are not close to zero, then they are noisy. |
0 commit comments