Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions JetStreamDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1236,24 +1236,25 @@ class Benchmark {
if (!plotContainer || !this.results || this.results.length === 0)
return;

const scores = this.results.map(time => toScore(time));
const scoreElement = document.getElementById(this.scoreIdentifier("Score"));
const width = scoreElement.offsetWidth;
const height = scoreElement.offsetHeight;

const padding = 5;
const maxResult = Math.max(...this.results);
const minResult = Math.min(...this.results);
const maxResult = Math.max(...scores);
const minResult = Math.min(...scores);

const xRatio = (width - 2 * padding) / (this.results.length - 1 || 1);
const xRatio = (width - 2 * padding) / (scores.length - 1 || 1);
const yRatio = (height - 2 * padding) / (maxResult - minResult || 1);
const radius = Math.max(1.5, Math.min(2.5, 10 - (this.iterations / 10)));

let circlesSVG = "";
for (let i = 0; i < this.results.length; i++) {
const result = this.results[i];
for (let i = 0; i < scores.length; i++) {
const result = scores[i];
const cx = padding + i * xRatio;
const cy = height - padding - (result - minResult) * yRatio;
const title = `Iteration ${i + 1}: ${uiFriendlyDuration(result)}`;
const title = `Iteration ${i + 1}: ${uiFriendlyScore(result)} (${uiFriendlyDuration(this.results[i])})`;
circlesSVG += `<circle cx="${cx}" cy="${cy}" r="${radius}"><title>${title}</title></circle>`;
}
plotContainer.innerHTML = `<svg width="${width}px" height="${height}px">${circlesSVG}</svg>`;
Expand Down
Loading