Docs: Update benchmark for moonshotai/kimi-k2.5

This commit is contained in:
github-actions[bot]
2026-01-28 02:13:45 +00:00
parent 0aa1b6e96e
commit 0f6d112bfb
11 changed files with 183 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
const hashPassword = async (p, s) => {
const { scrypt } = await import('https://esm.sh/scrypt-js@3.0.1');
const t = new TextEncoder();
const r = await scrypt(t.encode(p), t.encode(s), 1024, 8, 1, 32);
return Array.from(r, x => x.toString(16).padStart(2, '0')).join('');
};
export default hashPassword;
// Generation time: 36.319s
// Result: PASS

View File

@@ -0,0 +1,8 @@
const analyzeGPS = async (r, b) => {
const {booleanPointInPolygon, lineString, length} = await import('https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js');
const v = r.filter(x => booleanPointInPolygon({type: 'Point', coordinates: x.loc}, b, {ignoreBoundary: true})).sort((a, b) => a.ts - b.ts);
return v.length < 2 ? 0 : Math.round(length(lineString(v.map(x => x.loc))) * 100) / 100;
};
export default analyzeGPS;
// Generation time: 30.668s
// Result: FAIL

View File

@@ -0,0 +1,26 @@
const findShortestPath = async (g, s, e) => {
const { default: Q } = await import('https://esm.sh/js-priority-queue');
const d = {}, q = new Q({ comparator: (a, b) => a[0] - b[0] });
for (const k in g) d[k] = 1/0;
d[s] = 0;
q.queue([0, s]);
while (q.length) {
const [c, u] = q.dequeue();
if (u === e) return c;
if (c > d[u]) continue;
for (const v in g[u] || {}) {
const t = c + g[u][v];
if (t < d[v]) {
d[v] = t;
q.queue([t, v]);
}
}
}
return 1/0;
};
export default findShortestPath;
// Generation time: 56.044s
// Result: FAIL

View File

@@ -0,0 +1,14 @@
const findConvexHull=async p=>{
const{sortBy:s,uniqWith:u}=await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm');
const a=u(s(p,['x','y']),(p,q)=>p.x===q.x&&p.y===q.y),n=a.length;
if(n<2)return a;
const c=(o,a,b)=>(a.x-o.x)*(b.y-o.y)-(a.y-o.y)*(b.x-o.x),h=[];
for(let i=0;i<n;h.push(a[i++]))while(h.length>1&&c(h[h.length-2],h[h.length-1],a[i])<=0)h.pop();
const g=[];
for(let i=n-1;i>=0;g.push(a[i--]))while(g.length>1&&c(g[g.length-2],g[g.length-1],a[i])<=0)g.pop();
h.pop();g.pop();
return h.concat(g);
};
export default findConvexHull;
// Generation time: 77.946s
// Result: PASS

View File

@@ -0,0 +1,13 @@
const findLISLength = async a => {
if (!a?.length) return 0
const { bisectLeft: b } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm')
const t = []
for (const x of a) {
const i = b(t, x)
i === t.length ? t.push(x) : t[i] = x
}
return t.length
}
export default findLISLength;
// Generation time: 34.651s
// Result: PASS

View File

@@ -0,0 +1,9 @@
let h,p;
const renderTemplate=async(t,d)=>{
h??=await(p||=import('https://esm.sh/handlebars@4.7.8').then(m=>m.default));
return h.compile(t)(d);
};
export default renderTemplate;
// Generation time: 43.297s
// Result: PASS

View File

@@ -0,0 +1,10 @@
const parseMarkdown = (() => {
let m;
return async s => {
m = m || await import('https://esm.sh/marked');
return m.marked.parse(s);
};
})();
export default parseMarkdown;
// Generation time: 49.501s
// Result: PASS

View File

@@ -0,0 +1,17 @@
const processCSV = async (csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => {
const { default: Papa } = await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm');
const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true });
const groups = data.filter(r => r[filterColumn] == filterValue).reduce((acc, row) => {
const key = row[groupBy], val = +row[aggregateColumn] || 0;
(acc[key] ||= { sum: 0, count: 0 }).sum += val;
acc[key].count++;
return acc;
}, {});
return Object.entries(groups).map(([key, vals]) => ({
[groupBy]: key,
result: operation === 'count' ? vals.count : operation === 'avg' ? vals.sum / vals.count : vals.sum
}));
};
export default processCSV;
// Generation time: 34.470s
// Result: PASS

View File

@@ -0,0 +1,57 @@
const findAvailableSlots = async (c1, c2, c) => {
const { parseISO, addMinutes, min, max, isBefore, isAfter, compareAsc, startOfDay, addDays } = await import('https://esm.sh/date-fns@3.6.0');
const p = x => parseISO(x.endsWith('Z') ? x : x + 'Z');
const d = c.durationMinutes;
const rs = p(c.searchRange.start);
const re = p(c.searchRange.end);
const [h1, m1] = c.workHours.start.split(':').map(Number);
const [h2, m2] = c.workHours.end.split(':').map(Number);
const wm1 = h1 * 60 + m1;
const wm2 = h2 * 60 + m2;
const busy = [...c1, ...c2]
.map(x => ({ s: p(x.start), e: p(x.end) }))
.sort((a, b) => compareAsc(a.s, b.s));
const m = busy.reduce((a, b) => {
const l = a[a.length - 1];
if (!l || isBefore(l.e, b.s)) a.push(b);
else if (isAfter(b.e, l.e)) l.e = b.e;
return a;
}, []);
const free = [];
let cur = rs;
for (const b of m) {
if (isBefore(cur, b.s)) free.push({ s: cur, e: min([b.s, re]) });
cur = max([b.e, cur]);
if (!isBefore(cur, re)) break;
}
if (isBefore(cur, re)) free.push({ s: cur, e: re });
const r = [];
const ws = x => addMinutes(startOfDay(x), wm1);
const we = x => addMinutes(startOfDay(x), wm2);
for (const f of free) {
let day = startOfDay(f.s);
while (isBefore(day, f.e)) {
const a = max([f.s, ws(day), rs]);
const b = min([f.e, we(day), re]);
if (!isBefore(b, addMinutes(a, d))) {
let t = a;
while (!isAfter(addMinutes(t, d), b)) {
r.push({ start: t.toISOString(), end: addMinutes(t, d).toISOString() });
t = addMinutes(t, d);
}
}
day = addDays(day, 1);
}
}
return r;
};
export default findAvailableSlots;
// Generation time: 72.333s
// Result: PASS

View File

@@ -0,0 +1,16 @@
const validateJSON = async (d, s) => {
try {
const { default: Ajv } = await import('https://esm.sh/ajv@8.12.0');
const v = new Ajv({ allErrors: true }).compile(s);
const valid = v(d);
return {
valid,
errors: valid ? [] : v.errors.map(e => `${e.instancePath || 'root'}: ${e.message}`)
};
} catch (e) {
return { valid: false, errors: [e.message] };
}
};
export default validateJSON;
// Generation time: 27.586s
// Result: PASS

View File

@@ -0,0 +1,4 @@
const createStreamVisualizer=async(asyncIterable,options)=>{const{maxPoints,alpha,width,height,yDomain}=options;const d3=await import('https://cdn.jsdelivr.net/npm/d3@7/+esm');const data=[];let ema;for await(const{timestamp,value}of asyncIterable){ema=data.length?alpha*value+(1-alpha)*ema:value;data.push({timestamp,value,ema});if(data.length>maxPoints)data.shift()}if(!data.length)return{data,path:''};const x=d3.scaleLinear().domain([data[0].timestamp,data[data.length-1].timestamp]).range([0,width]);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;
// Generation time: 35.163s
// Result: PASS