mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark for x-ai/grok-4.1-fast
This commit is contained in:
21
tests/9_stream_visualizer/outputs/x-ai_grok-4.1-fast.js
Normal file
21
tests/9_stream_visualizer/outputs/x-ai_grok-4.1-fast.js
Normal file
@@ -0,0 +1,21 @@
|
||||
async function createStreamVisualizer(iter,opts){
|
||||
const d3=await import('https://cdn.skypack.dev/d3');
|
||||
const {maxPoints=500,alpha=.1,width=800,height=400,yDomain:[0,1]}=opts;
|
||||
let data=[],prevEma=null;
|
||||
for await(const {timestamp:t,value:v}of iter){
|
||||
const ema=prevEma===null?v:alpha*v+(1-alpha)*prevEma;
|
||||
prevEma=ema;
|
||||
data.push({timestamp:t,value:v,ema});
|
||||
if(data.length>maxPoints)data.shift();
|
||||
}
|
||||
if(data.length<2)return{data,path:"M 0 0"};
|
||||
const x0=data[0].timestamp,x1=data.at(-1).timestamp;
|
||||
const xScale=d3.scaleLinear().domain([x0,x1]).range([0,width]);
|
||||
const yScale=d3.scaleLinear().domain(yDomain).range([height,0]);
|
||||
const line=d3.line()
|
||||
.x(d=>xScale(d.timestamp))
|
||||
.y(d=>yScale(d.ema))
|
||||
.curve(d3.curveMonotoneX);
|
||||
return{data,path:line(data)};
|
||||
}
|
||||
export default createStreamVisualizer;
|
||||
Reference in New Issue
Block a user