Skip to content

Commit 9fb155d

Browse files
committed
saving.
1 parent 1f3fbb9 commit 9fb155d

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

html/index.html

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ <h1>Uint8Array Base64 Benchmark</h1>
138138
const ms = hz > 0 ? 1000 / hz : Infinity;
139139
const bytes = name.includes('fromBase64') ? bytesDecoded : bytesEncoded;
140140
const mbps = hz > 0 ? (bytes * hz / (1024*1024)) : 0;
141+
const moeMs = event.target.stats.moe * 1000;
142+
const relError = isFinite(ms) ? (moeMs / ms) * 100 : 0;
141143
const msDisplay = isFinite(ms) ? Number(ms).toPrecision(3) : '∞';
142-
const line = `${name.padEnd(32)} ${msDisplay} ms → ${mbps.toFixed(2)} MiB/s\n`;
144+
const line = `${name.padEnd(32)} ${msDisplay} ms ${relError.toFixed(2)}%) ${mbps.toFixed(2)} MiB/s\n`;
143145
resultsDiv.textContent += line;
144-
results.push({ size: s, name, hz, mbps: parseFloat(mbps) });
146+
results.push({ size: s, name, hz, mbps: parseFloat(mbps), moe: moeMs, relError });
145147
});
146148

147149
suite.on('complete', function() {
@@ -211,7 +213,19 @@ <h1>Uint8Array Base64 Benchmark</h1>
211213
responsive: true,
212214
plugins: {
213215
title: { display: true, text: 'Base64 Benchmark (MiB/s) by payload size' },
214-
tooltip: { mode: 'index', intersect: false }
216+
tooltip: {
217+
mode: 'index',
218+
intersect: false,
219+
callbacks: {
220+
label: function(context) {
221+
const size = sizes[context.dataIndex];
222+
const name = context.dataset.label;
223+
const entry = results.find(r => r.size === size && r.name === name);
224+
const relError = entry ? entry.relError : 0;
225+
return `${name}: ${context.parsed.y.toFixed(2)} MiB/s (±${relError.toFixed(2)}%)`;
226+
}
227+
}
228+
}
215229
},
216230
scales: {
217231
y: { beginAtZero: true, title: { display: true, text: 'MiB/s' } }

0 commit comments

Comments
 (0)