Docs: Update benchmark for openrouter/pony-alpha

This commit is contained in:
github-actions[bot]
2026-02-06 20:56:45 +00:00
parent 76e2886475
commit 4be9446973
10 changed files with 199 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
const analyzeGPS = async (readings, boundary) => {
const t = await import('https://esm.sh/@turf/turf');
const pts = readings
.filter(r => t.booleanPointInPolygon(t.point(r.loc), boundary))
.sort((a, b) => a.ts - b.ts)
.map(r => r.loc);
return pts.length < 2 ? 0 : Math.round(t.length(t.lineString(pts)) * 100) / 100;
};
export default analyzeGPS;
// Generation time: 93.284s
// Result: PASS

View File

@@ -0,0 +1,25 @@
const findShortestPath = async (graph, start, end) => {
const { default: PriorityQueue } = await import('https://esm.sh/js-priority-queue');
const dist = { [start]: 0 };
const pq = new PriorityQueue({ comparator: (a, b) => a.w - b.w });
pq.queue({ v: start, w: 0 });
while (pq.length) {
const { v, w } = pq.dequeue();
if (v === end) return w;
if (w > (dist[v] ?? Infinity)) continue;
const edges = graph[v] || {};
for (const n in edges) {
const nd = w + edges[n];
if (nd < (dist[n] ?? Infinity)) {
dist[n] = nd;
pq.queue({ v: n, w: nd });
}
}
}
return Infinity;
};
export default findShortestPath;
// Generation time: 136.164s
// Result: PASS

View File

@@ -0,0 +1,28 @@
const findConvexHull = async points => {
const _ = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.js');
const pts = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']);
if (pts.length < 3) return pts;
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
const lower = [];
for (const p of pts) {
while (lower.length > 1 && cross(lower.at(-2), lower.at(-1), p) <= 0) lower.pop();
lower.push(p);
}
const upper = [];
for (let i = pts.length - 1; i >= 0; i--) {
const p = pts[i];
while (upper.length > 1 && cross(upper.at(-2), upper.at(-1), p) <= 0) upper.pop();
upper.push(p);
}
lower.pop();
upper.pop();
return lower.concat(upper);
};
export default findConvexHull;
// Generation time: 170.869s
// Result: PASS

View File

@@ -0,0 +1,15 @@
const findLISLength = async nums => {
const { bisectLeft } = await import('https://esm.sh/d3-array')
const tails = []
for (const n of nums) {
const i = bisectLeft(tails, n)
if (i === tails.length) tails.push(n)
else tails[i] = n
}
return tails.length
}
export default findLISLength;
// Generation time: 197.616s
// Result: PASS

View File

@@ -0,0 +1,7 @@
const renderTemplate = async (t, d) => {
const { default: h } = await import('https://esm.sh/handlebars');
return h.compile(t)(d);
};
export default renderTemplate;
// Generation time: 110.510s
// Result: PASS

View File

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

View File

@@ -0,0 +1,18 @@
const processCSV = async (csv, { filterColumn: fc, filterValue: fv, groupBy: gb, aggregateColumn: ac, operation: op }) => {
const { default: Papa } = await import('https://esm.run/papaparse')
const { data } = Papa.parse(csv, { header: true })
const grouped = data.filter(r => r[fc] == fv).reduce((a, r) => {
const k = r[gb], v = +r[ac] || 0
a[k] = a[k] || { s: 0, c: 0 }
a[k].s += v
a[k].c++
return a
}, {})
return Object.entries(grouped).map(([k, { s, c }]) => ({
[gb]: k,
result: op === 'count' ? c : op === 'sum' ? s : s / c
}))
}
export default processCSV;
// Generation time: 257.221s
// Result: PASS

View File

@@ -0,0 +1,46 @@
const findAvailableSlots = async (cal1, cal2, { durationMinutes, searchRange, workHours }) => {
const dayjs = (await import('https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js')).default;
dayjs.extend((await import('https://cdn.jsdelivr.net/npm/dayjs@1/plugin/utc.js')).default);
const min = s => (s = s.split(':'), +s[0] * 60 + +s[1]);
const ts = s => dayjs.utc(s).valueOf();
const iso = t => new Date(t).toISOString();
const dur = durationMinutes * 60000;
const ws = min(workHours.start), we = min(workHours.end);
const rs = ts(searchRange.start), re = ts(searchRange.end);
const merged = [...cal1, ...cal2]
.map(x => ({ s: ts(x.start), e: ts(x.end) }))
.sort((a, b) => a.s - b.s)
.reduce((a, c) => {
if (a.length && c.s <= a[a.length - 1].e) a[a.length - 1].e = Math.max(a[a.length - 1].e, c.e);
else a.push(c);
return a;
}, []);
const fill = (start, end) => {
let t = start, res = [];
while (t + dur <= end) {
const sod = dayjs.utc(t).startOf('day').valueOf();
const s = sod + ws * 60000, e = sod + we * 60000;
if (t < s) t = s;
if (t >= e) { t = sod + 86400000; continue; }
if (t + dur <= e) {
if (t + dur <= end) res.push({ start: iso(t), end: iso(t + dur) }), t += dur;
else break;
} else t = sod + 86400000;
}
return res;
};
let curr = rs, slots = [];
merged.forEach(b => {
if (b.s > curr) slots.push(...fill(curr, Math.min(b.s, re)));
curr = Math.max(curr, b.e);
});
if (curr < re) slots.push(...fill(curr, re));
return slots;
};
export default findAvailableSlots;
// Generation time: 508.729s
// Result: FAIL

View File

@@ -0,0 +1,12 @@
const validateJSON = async (json, schema) => {
const { default: Ajv } = await import('https://esm.sh/ajv');
const validate = new Ajv().compile(schema);
const valid = validate(json);
return {
valid,
errors: valid ? [] : validate.errors.map(e => `${e.instancePath} ${e.message}`)
};
};
export default validateJSON;
// Generation time: 103.740s
// Result: PASS

View File

@@ -0,0 +1,30 @@
const createStreamVisualizer = async (iterable, { maxPoints, alpha, width, height, yDomain }) => {
const d3 = await import('https://esm.sh/d3');
const data = [];
let ema;
for await (const { timestamp, value } of iterable) {
ema = ema == null ? value : alpha * value + (1 - alpha) * ema;
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.at(-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: 253.115s
// Result: PASS