Docs: Update Gemini benchmark results

This commit is contained in:
github-actions[bot]
2025-11-18 22:04:41 +00:00
parent 31a18dd4ee
commit 33b8150958
220 changed files with 3259 additions and 1494 deletions

View File

@@ -1,28 +1,20 @@
export const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yD }) => {
const data = [];
let ema;
const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const D = [];
let e;
for await (const { timestamp: t, value: v } of src) {
ema = ema == null ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > m) data.shift();
e = e === undefined ? v : a * v + (1 - a) * e;
D.push({ timestamp: t, value: v, ema: e });
if (D.length > m) D.shift();
}
if (!data.length) return { data, path: '' };
if (!D.length) return { data: D, path: '' };
const { scaleLinear, line } = await import('d3');
const x = scaleLinear()
.domain([data[0].timestamp, data[data.length - 1].timestamp])
.range([0, w]);
const x = scaleLinear().domain([D[0].timestamp, D[D.length - 1].timestamp]).range([0, w]);
const y = scaleLinear().domain(yd).range([h, 0]);
const l = line().x(d => x(d.timestamp)).y(d => y(d.ema));
const y = scaleLinear()
.domain(yD)
.range([h, 0]);
return {
data,
path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
};
return { data: D, path: l(D) };
};
export default createStreamVisualizer;

View File

@@ -1,14 +1,20 @@
export const createStreamVisualizer = async (iter, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => {
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3/+esm')
let D = [], E
const createStreamVisualizer = async (iter, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => {
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
const D = []
let E
for await (const { timestamp: t, value: v } of iter) {
E = E == null ? v : A * v + (1 - A) * E
E = E === undefined ? v : A * v + (1 - A) * E
D.push({ timestamp: t, value: v, ema: E })
D.length > M && D.shift()
if (D.length > M) D.shift()
}
if (!D.length) return { data: [], path: "" }
const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W]),
y = scaleLinear().domain(Y).range([H, 0])
return { data: D, path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(D) }
if (!D.length) return { data: D, path: '' }
const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W])
const y = scaleLinear().domain(Y).range([H, 0])
const l = line().x(d => x(d.timestamp)).y(d => y(d.ema))
return { data: D, path: l(D) }
}
export default createStreamVisualizer;

View File

@@ -1,20 +1,29 @@
export const createStreamVisualizer = async (stream, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => {
export const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let ema;
let prev;
for await (const { timestamp: t, value: v } of stream) {
ema = ema === undefined ? v : A * v + (1 - A) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > M) data.shift();
for await (const { timestamp, value } of feed) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev;
prev = ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: '' };
if (!data.length) return { data, path: "" };
const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, W]);
const y = scaleLinear().domain(Y).range([H, 0]);
const gen = line().x(d => x(d.timestamp)).y(d => y(d.ema));
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
return { data, path: gen(data) };
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const pathGen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: pathGen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,20 +1,28 @@
export const createStreamVisualizer = async (src, { maxPoints: M, alpha: A, width: W, height: H, yDomain: YD }) => {
const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const D = [];
let E;
const data = [];
let ema;
for await (const { timestamp: t, value: v } of src) {
E = E == null ? v : A * v + (1 - A) * E;
D.push({ timestamp: t, value: v, ema: E });
if (D.length > M) D.shift();
for await (const { timestamp, value } of feed) {
ema = ema == null ? value : alpha * value + (1 - alpha) * ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!D.length) return { data: [], path: '' };
if (!data.length) return { data, path: '' };
const x = scaleLinear().domain([D[0].timestamp, D.at(-1).timestamp]).range([0, W]);
const y = scaleLinear().domain(YD).range([H, 0]);
const l = line().x(d => x(d.timestamp)).y(d => y(d.ema));
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
return { data: D, path: l(D) };
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const path = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))(data);
return { data, path: path || '' };
};
export default createStreamVisualizer;

View File

@@ -1,29 +1,27 @@
export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let prev;
export const createStreamVisualizer = async (feed, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
let data = [], ema;
for await (const { timestamp, value } of iter) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev;
prev = ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
for await (const { timestamp: t, value: v } of feed) {
ema = ema == null ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > m) data.shift();
}
if (!data.length) return { data, path: "" };
const x = scaleTime()
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
.range([0, w]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
.domain(yd)
.range([h, 0]);
const d = line()
.x(p => x(p.timestamp))
.y(p => y(p.ema))(data);
const gen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: d };
return { data, path: gen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,19 +1,27 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
const createStreamVisualizer = async (feed, { maxPoints: max, alpha, width, height, yDomain }) => {
const d3 = await import('https://esm.sh/d3');
let data = [], ema;
for await (const { timestamp: t, value: v } of stream) {
const prev = data.at(-1);
data.push({ timestamp: t, value: v, ema: prev ? alpha * v + (1 - alpha) * prev.ema : v });
if (data.length > maxPoints) data.shift();
for await (const { timestamp, value } of feed) {
ema = ema == null ? value : alpha * value + (1 - alpha) * ema;
data.push({ timestamp, value, ema });
if (data.length > max) data.shift();
}
if (!data.length) return { data, path: '' };
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 gen = line().x(d => x(d.timestamp)).y(d => y(d.ema));
const x = d3.scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
return { data, path: gen(data) };
const y = d3.scaleLinear()
.domain(yDomain)
.range([height, 0]);
const path = d3.line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))(data);
return { data, path };
};
export default createStreamVisualizer;

View File

@@ -1,29 +1,20 @@
const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
export const createStreamVisualizer = async (src, { maxPoints: m, alpha: a, width: w, height: h, yDomain: yd }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let prev;
let ema;
for await (const { timestamp, value } of feed) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev;
prev = ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
for await (const { timestamp: t, value: v } of src) {
ema = ema === undefined ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > m) data.shift();
}
if (!data.length) return { data, path: '' };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const x = scaleLinear().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]);
const y = scaleLinear().domain(yd).range([h, 0]);
const d = line().x(p => x(p.timestamp)).y(p => y(p.ema))(data);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const generator = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: generator(data) || '' };
return { data, path: d || '' };
};
export default createStreamVisualizer;

View File

@@ -1,10 +1,10 @@
export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('d3');
const data = [];
let ema;
for await (const { timestamp, value } of iter) {
ema = ema == null ? value : alpha * value + (1 - alpha) * ema;
for await (const { timestamp, value } of stream) {
ema = (ema ?? value) * (1 - alpha) + value * alpha;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
@@ -19,10 +19,10 @@ export const createStreamVisualizer = async (iter, { maxPoints, alpha, width, he
.domain(yDomain)
.range([height, 0]);
const path = line()
const pathGen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))(data);
.y(d => y(d.ema));
return { data, path };
return { data, path: pathGen(data) };
};
export default createStreamVisualizer;

View File

@@ -1,28 +1,20 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const d3 = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm');
export const createStreamVisualizer = async (src, { maxPoints: max, alpha: a, width: w, height: h, yDomain: yD }) => {
const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
let ema;
for await (const { timestamp, value } of stream) {
ema = ema === undefined ? value : alpha * value + (1 - alpha) * ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
for await (const { timestamp: t, value: v } of src) {
ema = ema == null ? v : a * v + (1 - a) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > max) data.shift();
}
if (!data.length) return { data, path: '' };
const x = d3.scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const x = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]);
const y = scaleLinear().domain(yD).range([h, 0]);
const path = line().x(d => x(d.timestamp)).y(d => y(d.ema))(data);
const y = d3.scaleLinear()
.domain(yDomain)
.range([height, 0]);
const path = d3.line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))(data);
return { data, path };
return { data, path: path || '' };
};
export default createStreamVisualizer;

View File

@@ -1,28 +1,28 @@
const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7');
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
let ema;
for await (const { timestamp, value } of stream) {
ema = data.length ? alpha * value + (1 - alpha) * ema : value;
const prev = data.at(-1);
const ema = prev ? alpha * value + (1 - alpha) * prev.ema : value;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: '' };
if (!data.length) return { data, path: null };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const pathGen = line()
const generator = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: pathGen(data) };
return { data, path: generator(data) };
};
export default createStreamVisualizer;

View File

@@ -0,0 +1,25 @@
export const createStreamVisualizer = async (
stream,
{ maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }
) => {
const { scaleLinear, line } = await import("https://esm.sh/d3@7");
const data = [];
let ema;
for await (const { timestamp: t, value: v } of stream) {
ema = ema == null ? v : A * v + (1 - A) * ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > M) data.shift();
}
if (!data.length) return { data, path: "" };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, W]);
const y = scaleLinear().domain(Y).range([H, 0]);
const path = line().x(d => x(d.timestamp)).y(d => y(d.ema))(data);
return { data, path };
};
export default createStreamVisualizer;

View File

@@ -0,0 +1,29 @@
export const createStreamVisualizer = async (feed, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
const data = []
let prev = null
for await (const { timestamp, value } of feed) {
const ema = prev === null ? value : alpha * value + (1 - alpha) * prev
prev = ema
data.push({ timestamp, value, ema })
if (data.length > maxPoints) data.shift()
}
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 gen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema))
return { data, path: gen(data) }
}
export default createStreamVisualizer;

View File

@@ -0,0 +1,14 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
let data = [], ema
for await (const { timestamp: t, value: v } of stream) {
ema = ema === undefined ? v : alpha * v + (1 - alpha) * ema
data.push({ timestamp: t, value: v, ema })
if (data.length > maxPoints) data.shift()
}
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])
return { data, path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data) }
}
export default createStreamVisualizer;

View File

@@ -0,0 +1,32 @@
export const createStreamVisualizer = async (
source,
{ maxPoints: max, alpha, width, height, yDomain }
) => {
const { scaleTime, scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm');
let data = [], prev;
for await (const { timestamp: t, value: v } of source) {
const ema = prev === undefined ? v : alpha * v + (1 - alpha) * prev;
prev = ema;
data.push({ timestamp: t, value: v, ema });
if (data.length > max) data.shift();
}
if (!data.length) return { data, path: "" };
const x = scaleTime()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width]);
const y = scaleLinear()
.domain(yDomain)
.range([height, 0]);
const pathGen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: pathGen(data) };
};
export default createStreamVisualizer;

View File

@@ -0,0 +1,20 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3@7');
const data = [];
let ema;
for await (const { timestamp, value } of stream) {
ema = alpha * value + (1 - alpha) * (ema ?? value);
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
if (!data.length) return { data, path: '' };
const getX = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, width]);
const getY = scaleLinear().domain(yDomain).range([height, 0]);
const gen = line().x(d => getX(d.timestamp)).y(d => getY(d.ema));
return { data, path: gen(data) };
};
export default createStreamVisualizer;

View File

@@ -0,0 +1,21 @@
const createStreamVisualizer = async (feed, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => {
const { scaleLinear: S, line: L } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
const data = []; let ema
for await (const { timestamp: t, value: v } of feed) {
ema = ema == null ? v : A * v + (1 - A) * ema
data.push({ timestamp: t, value: v, ema })
if (data.length > M) data.shift()
}
if (!data.length) return { data, path: '' }
const x = S().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, W])
const y = S().domain(Y).range([H, 0])
return {
data,
path: L().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
}
}
export default createStreamVisualizer;

View File

@@ -0,0 +1,31 @@
export const createStreamVisualizer = async (
stream,
{ maxPoints, alpha, width, height, yDomain }
) => {
const { scaleLinear, line } = await import('https://esm.sh/d3@7')
const data = []
let prev
for await (const { timestamp, value } of stream) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev
prev = ema
if (data.push({ timestamp, value, ema }) > maxPoints) data.shift()
}
if (!data.length) return { data, path: '' }
const xScale = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, width])
const yScale = scaleLinear()
.domain(yDomain)
.range([height, 0])
const generator = line()
.x(d => xScale(d.timestamp))
.y(d => yScale(d.ema))
return { data, path: generator(data) }
}
export default createStreamVisualizer;

View File

@@ -0,0 +1,29 @@
export const createStreamVisualizer = async (stream, { maxPoints, alpha, width, height, yDomain }) => {
const data = [];
let prev;
for await (const { timestamp, value } of stream) {
prev = prev ?? value;
const ema = prev = alpha * value + (1 - alpha) * prev;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
const { scaleLinear, line } = await import('https://cdn.jsdelivr.net/npm/d3@7/+esm');
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]);
return {
data,
path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
};
};
export default createStreamVisualizer;

View File

@@ -1,28 +1,23 @@
export const createStreamVisualizer = async (stream, { maxPoints: M, alpha: A, width: W, height: H, yDomain: Y }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
export const createStreamVisualizer = async (iter, { maxPoints: max, alpha, width: w, height: h, yDomain }) => {
const { scaleTime, scaleLinear, line } = await import('https://esm.sh/d3');
const data = [];
let ema;
let prev;
for await (const { timestamp: t, value: v } of stream) {
ema = ema == null ? v : A * v + (1 - A) * ema;
for await (const { timestamp: t, value: v } of iter) {
const ema = prev == null ? v : alpha * v + (1 - alpha) * prev;
data.push({ timestamp: t, value: v, ema });
if (data.length > M) data.shift();
if (data.length > max) data.shift();
prev = ema;
}
if (!data.length) return { data, path: null };
if (!data.length) return { data, path: '' };
const x = scaleLinear()
.domain([data[0].timestamp, data.at(-1).timestamp])
.range([0, W]);
const x = scaleTime().domain([data[0].timestamp, data.at(-1).timestamp]).range([0, w]);
const y = scaleLinear().domain(yDomain).range([h, 0]);
const y = scaleLinear()
.domain(Y)
.range([H, 0]);
const gen = line()
.x(d => x(d.timestamp))
.y(d => y(d.ema));
return { data, path: gen(data) };
return {
data,
path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
};
};
export default createStreamVisualizer;

View File

@@ -0,0 +1,22 @@
export const createStreamVisualizer = async (stream, { maxPoints: max, alpha, width, height, yDomain }) => {
const { scaleLinear, line } = await import('https://esm.sh/d3');
let data = [], prev;
for await (const { timestamp, value } of stream) {
const ema = prev == null ? value : alpha * value + (1 - alpha) * prev;
data.push({ timestamp, value, ema });
if (data.length > max) data.shift();
prev = ema;
}
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]);
return {
data,
path: line().x(d => x(d.timestamp)).y(d => y(d.ema))(data)
};
};
export default createStreamVisualizer;