perf: filter out commits that don't belong to the history in charts

This change adds a data cleaning step to the charts that removes points
which don't correspond to a commit that appears in the history. The
purpose of this change is primarily to work around a bug in golangbuild
that caused subrepo benchmark results to get tagged with a commit from
the main Go repository. This results in (artistically) broken charts for
subrepo benchmarks.

Change-Id: I4090c392f81f49d08a1aedcb8d77a5fbf9bf7bb7
Reviewed-on: https://go-review.googlesource.com/c/build/+/588136
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Anthony Knyszek 2024-05-24 19:10:30 +00:00 коммит произвёл Michael Knyszek
Родитель 22ca23754d
Коммит 6fba8f3f18
1 изменённых файлов: 10 добавлений и 0 удалений

10
third_party/bandchart/bandchart.js поставляемый
Просмотреть файл

@ -17,6 +17,16 @@ function BandChart(data, {
higherIsBetter,
history,
} = {}) {
// Compute a set of valid hashes so we can filter out any bad values.
// This is to work around a bug where some test results have bad commits
// attached to them.
// TODO(mknyszek): Consider doing this data cleaning server-side.
let historySet = new Set();
for (let i = 0; i < history.length; i++) {
historySet.add(history[i].Hash);
}
data = data.filter(d => historySet.has(d.CommitHash));
// Compute values.
const CT = d3.map(data, d => d.CommitDate);
const X = d3.map(data, d => d.CommitHash);