Docs: Update benchmark results

This commit is contained in:
github-actions[bot]
2025-11-18 17:37:06 +00:00
parent 39d057f079
commit afcfd09537
84 changed files with 1086 additions and 1088 deletions

View File

@@ -11,42 +11,32 @@ async function createStreamVisualizer(asyncIterable, {
} = await import('d3');
const data = [];
let prevEma = null;
let prevEma;
for await (const {
timestamp,
value
} of asyncIterable) {
const ema = prevEma === null ?
for await (const { value, timestamp } of asyncIterable) {
prevEma = (prevEma === undefined) ?
value :
alpha * value + (1 - alpha) * prevEma;
data.push({
timestamp,
value,
ema
ema: prevEma
});
prevEma = ema;
if (data.length > maxPoints) {
data.shift();
}
}
if (data.length < 2) {
if (!data.length) {
return {
data,
path: ''
};
}
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const x = scaleLinear([data[0].timestamp, data.at(-1).timestamp], [0, width]);
const y = scaleLinear(yDomain, [height, 0]);
const path = line()
.x(d => x(d.timestamp))
@@ -54,7 +44,7 @@ async function createStreamVisualizer(asyncIterable, {
return {
data,
path
path: path ?? ''
};
}
export default createStreamVisualizer;