Docs: Update benchmark for anthropic/claude-opus-4.6 TEMP:0.7

This commit is contained in:
github-actions[bot]
2026-02-05 19:39:59 +00:00
parent b0c93b9efa
commit 73a72a2b7e
11 changed files with 298 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
async function hashPassword(password, salt) {
const { scrypt } = await import("https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm");
const enc = new TextEncoder();
const hash = await scrypt(enc.encode(password), enc.encode(salt), 1024, 8, 1, 32);
return Array.from(hash, b => b.toString(16).padStart(2, "0")).join("");
}
export default hashPassword;
// Generation time: 2.342s
// Result: PASS

View File

@@ -0,0 +1,17 @@
async function analyzeGPS(readings, boundary) {
const turf = await import("https://cdn.jsdelivr.net/npm/@turf/turf@7/+esm");
const valid = readings
.filter(r => turf.booleanPointInPolygon(turf.point(r.loc), boundary, { ignoreBoundary: true }))
.sort((a, b) => a.ts - b.ts);
if (valid.length < 2) return 0;
const line = turf.lineString(valid.map(r => r.loc));
const len = turf.length(line, { units: "kilometers" });
return Math.round(len * 100) / 100;
}
export default analyzeGPS;
// Generation time: 3.774s
// Result: PASS

View File

@@ -0,0 +1,37 @@
async function findShortestPath(graph, start, end) {
const { default: PriorityQueue } = await import(
"https://cdn.jsdelivr.net/npm/js-priority-queue@0.4.1/+esm"
);
const dist = {};
for (const node in graph) dist[node] = Infinity;
dist[start] = 0;
const pq = new PriorityQueue({ comparator: (a, b) => a[1] - b[1] });
pq.queue([start, 0]);
const visited = new Set();
while (pq.length > 0) {
const [node, d] = pq.dequeue();
if (node === end) return d;
if (visited.has(node)) continue;
visited.add(node);
if (!graph[node]) continue;
for (const [neighbor, weight] of Object.entries(graph[node])) {
const newDist = d + weight;
if (newDist < (dist[neighbor] ?? Infinity)) {
dist[neighbor] = newDist;
pq.queue([neighbor, newDist]);
}
}
}
return dist[end] ?? Infinity;
}
export default findShortestPath;
// Generation time: 5.349s
// Result: FAIL

View File

@@ -0,0 +1,33 @@
async function findConvexHull(points) {
const _ = (await import("https://cdn.jsdelivr.net/npm/lodash-es/lodash.js")).default;
const unique = _.uniqWith(points, _.isEqual);
const sorted = _.sortBy(unique, ["x", "y"]);
if (sorted.length <= 1) return sorted;
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 sorted) {
while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], p) <= 0)
lower.pop();
lower.push(p);
}
const upper = [];
for (const p of _.reverse([...sorted])) {
while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], p) <= 0)
upper.pop();
upper.push(p);
}
lower.pop();
upper.pop();
return [...lower, ...upper];
}
export default findConvexHull;
// Generation time: 5.094s
// Result: PASS

View File

@@ -0,0 +1,13 @@
async function findLISLength(nums) {
const { bisectLeft } = await import("https://cdn.jsdelivr.net/npm/d3-array/+esm");
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: 2.405s
// Result: PASS

View File

@@ -0,0 +1,7 @@
async function renderTemplate(template, data) {
const { default: Handlebars } = await import("https://cdn.jsdelivr.net/npm/handlebars@4.7.8/+esm");
return Handlebars.compile(template)(data);
}
export default renderTemplate;
// Generation time: 2.282s
// Result: PASS

View File

@@ -0,0 +1,7 @@
async function parseMarkdown(md) {
const { marked } = await import("https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js");
return marked.parse(md);
}
export default parseMarkdown;
// Generation time: 2.445s
// Result: PASS

View File

@@ -0,0 +1,36 @@
async function processCSV(csv, config) {
const { filterColumn, filterValue, groupBy, aggregateColumn, operation } = config;
const { default: Papa } = await import("https://cdn.jsdelivr.net/npm/papaparse@5/+esm");
const parsed = Papa.parse(csv.trim(), { header: true, skipEmptyLines: true });
const rows = parsed.data;
const filtered = rows.filter(r => r[filterColumn] == filterValue);
const groups = new Map();
for (const row of filtered) {
const key = row[groupBy];
if (!groups.has(key)) groups.set(key, []);
groups.get(key).push(row);
}
const toNum = v => {
const n = Number(v);
return Number.isFinite(n) ? n : 0;
};
return [...groups.entries()].map(([groupValue, rows]) => {
let result;
if (operation === "count") {
result = rows.length;
} else {
const sum = rows.reduce((acc, r) => acc + toNum(r[aggregateColumn]), 0);
result = operation === "avg" ? sum / rows.length : sum;
}
return { [groupBy]: groupValue, result };
});
}
export default processCSV;
// Generation time: 6.543s
// Result: PASS

View File

@@ -0,0 +1,88 @@
async function findAvailableSlots(calendar1, calendar2, constraints) {
const { DateTime, Interval } = await import("https://cdn.jsdelivr.net/npm/luxon@3/+esm");
const { durationMinutes, searchRange, workHours } = constraints;
const rangeStart = DateTime.fromISO(searchRange.start, { zone: "utc" });
const rangeEnd = DateTime.fromISO(searchRange.end, { zone: "utc" });
const [whStartH, whStartM] = workHours.start.split(":").map(Number);
const [whEndH, whEndM] = workHours.end.split(":").map(Number);
const allBusy = [...calendar1, ...calendar2]
.map(b => ({
s: DateTime.fromISO(b.start, { zone: "utc" }),
e: DateTime.fromISO(b.end, { zone: "utc" })
}))
.sort((a, b) => a.s - b.s);
const merged = [];
for (const slot of allBusy) {
if (merged.length && slot.s <= merged[merged.length - 1].e) {
merged[merged.length - 1].e = DateTime.max(merged[merged.length - 1].e, slot.e);
} else {
merged.push({ s: slot.s, e: slot.e });
}
}
const freePeriods = [];
let cursor = rangeStart;
for (const busy of merged) {
if (busy.s > cursor) {
freePeriods.push({ s: cursor, e: DateTime.min(busy.s, rangeEnd) });
}
cursor = DateTime.max(cursor, busy.e);
}
if (cursor < rangeEnd) {
freePeriods.push({ s: cursor, e: rangeEnd });
}
const workWindows = [];
let day = rangeStart.startOf("day");
const lastDay = rangeEnd.startOf("day").plus({ days: 1 });
while (day < lastDay) {
const ws = day.set({ hour: whStartH, minute: whStartM, second: 0, millisecond: 0 });
const we = day.set({ hour: whEndH, minute: whEndM, second: 0, millisecond: 0 });
if (we > ws) {
const clampedStart = DateTime.max(ws, rangeStart);
const clampedEnd = DateTime.min(we, rangeEnd);
if (clampedStart < clampedEnd) {
workWindows.push({ s: clampedStart, e: clampedEnd });
}
}
day = day.plus({ days: 1 });
}
const effectiveFree = [];
for (const free of freePeriods) {
for (const ww of workWindows) {
const s = DateTime.max(free.s, ww.s);
const e = DateTime.min(free.e, ww.e);
if (s < e) {
effectiveFree.push({ s, e });
}
}
}
effectiveFree.sort((a, b) => a.s - b.s);
const results = [];
const dur = { minutes: durationMinutes };
for (const period of effectiveFree) {
let slotStart = period.s;
while (true) {
const slotEnd = slotStart.plus(dur);
if (slotEnd > period.e) break;
results.push({
start: slotStart.toISO(),
end: slotEnd.toISO()
});
slotStart = slotEnd;
}
}
return results;
}
export default findAvailableSlots;
// Generation time: 12.695s
// Result: PASS

View File

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

View File

@@ -0,0 +1,36 @@
async function createStreamVisualizer(asyncIterable, options) {
const { maxPoints, alpha, width, height, yDomain } = options;
const d3 = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm");
const data = [];
let prevEma = null;
for await (const { timestamp, value } of asyncIterable) {
const ema = prevEma === null
? value
: alpha * value + (1 - alpha) * prevEma;
prevEma = ema;
data.push({ timestamp, value, ema });
if (data.length > maxPoints) data.shift();
}
const xScale = d3.scaleLinear()
.domain([data[0].timestamp, data[data.length - 1].timestamp])
.range([0, width]);
const yScale = d3.scaleLinear()
.domain(yDomain)
.range([height, 0]);
const lineGen = d3.line()
.x(d => xScale(d.timestamp))
.y(d => yScale(d.ema));
const path = lineGen(data);
return { data, path };
}
export default createStreamVisualizer;
// Generation time: 5.157s
// Result: PASS