mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark for z-ai/glm-4.7
This commit is contained in:
19
tests/9_stream_visualizer/outputs/z-ai_glm-4.7.js
Normal file
19
tests/9_stream_visualizer/outputs/z-ai_glm-4.7.js
Normal file
@@ -0,0 +1,19 @@
|
||||
async function createStreamVisualizer(stream, { maxPoints, alpha, width, height, yDomain }) {
|
||||
const { scaleLinear, line } = await import('https://esm.sh/d3');
|
||||
const data = [];
|
||||
let ema;
|
||||
|
||||
for await (const { value, timestamp = Date.now() } of stream) {
|
||||
ema = ema === undefined ? value : alpha * value + (1 - alpha) * ema;
|
||||
data.push({ timestamp, value, ema });
|
||||
if (data.length > maxPoints) data.shift();
|
||||
}
|
||||
|
||||
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;
|
||||
// Generation time: 111.818s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user