From e58cbc2af2be26f6597effa737dcc98158859cdd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 17 Apr 2026 01:01:24 +0000 Subject: [PATCH] Docs: Update benchmark for anthropic/claude-opus-4.7 EFF:medium --- .../anthropic_claude-opus-4.7 EFF_medium.js | 9 +++ .../anthropic_claude-opus-4.7 EFF_medium.js | 12 ++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 62 +++++++++++++++++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 24 +++++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 20 ++++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 46 ++++++++++++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 58 +++++++++++++++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 7 +++ .../anthropic_claude-opus-4.7 EFF_medium.js | 23 +++++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 52 ++++++++++++++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 13 ++++ .../anthropic_claude-opus-4.7 EFF_medium.js | 31 ++++++++++ 12 files changed, 357 insertions(+) create mode 100644 tests/10_scrypt_hash/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/11_geospatial/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/12_mst_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/1_dijkstra/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/2_convex_hull/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/3_signal_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/4_hexchain_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/5_markdown_parser/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/6_csv_processor/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/7_scheduler/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/8_json_validator/outputs/anthropic_claude-opus-4.7 EFF_medium.js create mode 100644 tests/9_stream_visualizer/outputs/anthropic_claude-opus-4.7 EFF_medium.js diff --git a/tests/10_scrypt_hash/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/10_scrypt_hash/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..86fd51b --- /dev/null +++ b/tests/10_scrypt_hash/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,9 @@ +const hashPassword = async (password, salt) => { + const { scrypt } = await import('https://esm.sh/scrypt-js'); + const enc = new TextEncoder(); + const hash = await scrypt(enc.encode(password), enc.encode(salt), 1024, 8, 1, 32); + return [...hash].map(b => b.toString(16).padStart(2, '0')).join(''); +}; +export default hashPassword; +// Generation time: 2.662s +// Result: PASS \ No newline at end of file diff --git a/tests/11_geospatial/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/11_geospatial/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..695b94c --- /dev/null +++ b/tests/11_geospatial/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (readings, boundary) => { + const turf = await import('https://cdn.skypack.dev/@turf/turf'); + const valid = readings + .filter(r => turf.booleanWithin(turf.point(r.loc), boundary)) + .sort((a, b) => a.ts - b.ts); + if (valid.length < 2) return 0; + const line = turf.lineString(valid.map(r => r.loc)); + return Math.round(turf.length(line, { units: 'kilometers' }) * 100) / 100; +}; +export default analyzeGPS; +// Generation time: 3.035s +// Result: PASS \ No newline at end of file diff --git a/tests/12_mst_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/12_mst_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..8831f03 --- /dev/null +++ b/tests/12_mst_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,62 @@ +async function computeMST(tomlString) { + const [{parse}, {default: Heap}, {default: textTable}] = await Promise.all([ + import('https://esm.sh/smol-toml'), + import('https://esm.sh/mnemonist/heap'), + import('https://esm.sh/text-table') + ]); + + const {edges = []} = parse(tomlString); + const heap = new Heap((a, b) => a.weight - b.weight); + const nodes = new Set(); + + for (const e of edges) { + heap.push(e); + nodes.add(e.from); + nodes.add(e.to); + } + + const parent = new Map(), rank = new Map(); + for (const n of nodes) { + parent.set(n, n); + rank.set(n, 0); + } + + const find = x => { + let r = x; + while (parent.get(r) !== r) r = parent.get(r); + while (parent.get(x) !== r) { + const next = parent.get(x); + parent.set(x, r); + x = next; + } + return r; + }; + + const union = (a, b) => { + const ra = find(a), rb = find(b); + if (ra === rb) return false; + const sa = rank.get(ra), sb = rank.get(rb); + if (sa < sb) parent.set(ra, rb); + else if (sa > sb) parent.set(rb, ra); + else { parent.set(rb, ra); rank.set(ra, sa + 1); } + return true; + }; + + const mst = []; + let totalWeight = 0; + const target = nodes.size - 1; + + while (heap.size && mst.length < target) { + const e = heap.pop(); + if (union(e.from, e.to)) { + mst.push([e.from, e.to, String(e.weight)]); + totalWeight += e.weight; + } + } + + const table = textTable([['From', 'To', 'Weight'], ...mst]); + return {table, totalWeight}; +} +export default computeMST; +// Generation time: 7.828s +// Result: PASS \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/1_dijkstra/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..b82dd50 --- /dev/null +++ b/tests/1_dijkstra/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,24 @@ +async function findShortestPath(graph, start, end) { + const { default: PriorityQueue } = await import('https://esm.sh/js-priority-queue'); + const dist = {}; + for (const n in graph) dist[n] = Infinity; + dist[start] = 0; + const pq = new PriorityQueue({ comparator: (a, b) => a[0] - b[0] }); + pq.queue([0, start]); + while (pq.length) { + const [d, node] = pq.dequeue(); + if (node === end) return d; + if (d > dist[node]) continue; + for (const [next, w] of Object.entries(graph[node] || {})) { + const nd = d + w; + if (nd < (dist[next] ?? Infinity)) { + dist[next] = nd; + pq.queue([nd, next]); + } + } + } + return Infinity; +} +export default findShortestPath; +// Generation time: 4.505s +// Result: PASS \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/2_convex_hull/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..3cb5b9f --- /dev/null +++ b/tests/2_convex_hull/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,20 @@ +async function findConvexHull(points) { + const _ = (await import('https://cdn.skypack.dev/lodash')).default; + const pts = _.sortBy(_.uniqWith(points, (a, b) => a.x === b.x && a.y === b.y), ['x', 'y']); + if (pts.length < 2) return pts.slice(); + const cross = (O, A, B) => (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x); + const build = arr => { + const h = []; + for (const p of arr) { + while (h.length >= 2 && cross(h[h.length - 2], h[h.length - 1], p) <= 0) h.pop(); + h.push(p); + } + return h; + }; + const lower = build(pts); + const upper = build([...pts].reverse()); + return [...lower.slice(0, -1), ...upper.slice(0, -1)]; +} +export default findConvexHull; +// Generation time: 4.186s +// Result: PASS \ No newline at end of file diff --git a/tests/3_signal_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/3_signal_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..3a73916 --- /dev/null +++ b/tests/3_signal_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,46 @@ +async function analyzeSignal(yamlStr) { + const [yaml, math, ndarray, fft, DOMPurify] = (await Promise.all([ + import('https://esm.sh/js-yaml'), + import('https://esm.sh/mathjs'), + import('https://esm.sh/ndarray'), + import('https://esm.sh/ndarray-fft'), + import('https://esm.sh/dompurify') + ])).map(m => m.default ?? m); + + const cfg = yaml.load(yamlStr); + const N = cfg.sampleRate * cfg.duration; + const signal = Array.from({ length: N }, (_, i) => { + const t = i / cfg.sampleRate; + return cfg.components.reduce( + (s, c) => s + c.amplitude * math.sin(2 * math.pi * c.frequency * t), + 0 + ); + }); + + const real = ndarray(new Float64Array(signal), [N]); + const imag = ndarray(new Float64Array(N), [N]); + fft(1, real, imag); + + const half = N / 2; + const peaks = []; + for (let k = 0; k <= half; k++) { + const mag = math.sqrt(real.get(k) ** 2 + imag.get(k) ** 2) / half; + if (mag > 0.1) { + peaks.push({ + frequencyHz: Math.round(k * cfg.sampleRate / N), + magnitude: Math.round(mag * 100) / 100 + }); + } + } + peaks.sort((a, b) => b.magnitude - a.magnitude); + + const rows = peaks.map(p => `${p.frequencyHz}${p.magnitude}`).join(''); + const html = DOMPurify.sanitize( + `${rows}
Frequency (Hz)Magnitude
` + ); + + return { peaks, html, signalLength: N }; +} +export default analyzeSignal; +// Generation time: 9.148s +// Result: PASS \ No newline at end of file diff --git a/tests/4_hexchain_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/4_hexchain_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..9b89c90 --- /dev/null +++ b/tests/4_hexchain_pipeline/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,58 @@ +const hexchain = async toml => { + const CDN = 'https://esm.sh/'; + const [ + {parse}, + {default: seedrandom}, + ss, + {default: Ajv}, + {default: table}, + {default: DOMPurify} + ] = await Promise.all([ + import(`${CDN}smol-toml`), + import(`${CDN}seedrandom`), + import(`${CDN}simple-statistics`), + import(`${CDN}ajv`), + import(`${CDN}text-table`), + import(`${CDN}dompurify`) + ]); + + const config = parse(toml); + const schema = { + type: 'object', + required: ['seed', 'count', 'label'], + properties: { + seed: {type: 'string'}, + count: {type: 'integer', minimum: 1, maximum: 10000}, + label: {type: 'string', minLength: 1} + } + }; + const ajv = new Ajv(); + const validate = ajv.compile(schema); + if (!validate(config)) return {valid: false, errors: ajv.errorsText(validate.errors)}; + + const rng = new seedrandom(config.seed); + const nums = Array.from({length: config.count}, () => rng()); + const r = n => Math.round(n * 1e6) / 1e6; + const mean = r(ss.mean(nums)); + const stddev = r(ss.standardDeviation(nums)); + const median = r(ss.median(nums)); + + const tableStr = table([ + ['Stat', 'Value'], + ['mean', String(mean)], + ['stddev', String(stddev)], + ['median', String(median)] + ]); + const sanitized = DOMPurify.sanitize(`
${tableStr}
`); + + return { + valid: true, + label: config.label, + stats: {mean, stddev, median}, + table: sanitized, + count: config.count + }; +}; +export default hexchain; +// Generation time: 8.530s +// Result: PASS \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/5_markdown_parser/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..46fd8eb --- /dev/null +++ b/tests/5_markdown_parser/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,7 @@ +const parseMarkdown = async md => { + const { marked } = await import('https://cdn.jsdelivr.net/npm/marked/+esm'); + return marked.parse(md); +}; +export default parseMarkdown; +// Generation time: 1.391s +// Result: PASS \ No newline at end of file diff --git a/tests/6_csv_processor/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/6_csv_processor/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..c6e985f --- /dev/null +++ b/tests/6_csv_processor/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,23 @@ +async function processCSV(csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) { + const { default: Papa } = await import('https://esm.sh/papaparse@5.4.1'); + const { data } = Papa.parse(csv, { header: true, skipEmptyLines: true }); + const groups = {}; + for (const row of data) { + if (row[filterColumn] != filterValue) continue; + const key = row[groupBy]; + const n = Number(row[aggregateColumn]); + const val = Number.isFinite(n) ? n : 0; + (groups[key] ??= { sum: 0, count: 0 }); + groups[key].sum += val; + groups[key].count++; + } + const calc = { + sum: g => g.sum, + avg: g => g.sum / g.count, + count: g => g.count, + }[operation]; + return Object.entries(groups).map(([k, g]) => ({ [groupBy]: k, result: calc(g) })); +} +export default processCSV; +// Generation time: 5.004s +// Result: PASS \ No newline at end of file diff --git a/tests/7_scheduler/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/7_scheduler/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..0f4600e --- /dev/null +++ b/tests/7_scheduler/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,52 @@ +async function findAvailableSlots(cal1, cal2, { durationMinutes, searchRange, workHours }) { + const { parseISO, addMinutes } = await import('https://cdn.skypack.dev/date-fns'); + const ms = s => parseISO(s).getTime(); + const iso = t => new Date(t).toISOString(); + const parseHM = t => { + const [h, m] = t.split(':').map(Number); + return (h * 60 + m) * 60000; + }; + + const rs = ms(searchRange.start); + const re = ms(searchRange.end); + const durMs = durationMinutes * 60000; + const whS = parseHM(workHours.start); + const whE = parseHM(workHours.end); + const DAY = 86400000; + + const merged = [...cal1, ...cal2] + .map(b => [ms(b.start), ms(b.end)]) + .filter(([s, e]) => e > rs && s < re) + .map(([s, e]) => [Math.max(s, rs), Math.min(e, re)]) + .sort((a, b) => a[0] - b[0]) + .reduce((acc, [s, e]) => { + const last = acc.at(-1); + if (last && s <= last[1]) last[1] = Math.max(last[1], e); + else acc.push([s, e]); + return acc; + }, []); + + const free = []; + let cur = rs; + for (const [s, e] of merged) { + if (s > cur) free.push([cur, s]); + cur = Math.max(cur, e); + } + if (cur < re) free.push([cur, re]); + + const slots = []; + for (const [fs, fe] of free) { + for (let day = Math.floor(fs / DAY) * DAY; day < fe; day += DAY) { + const s = Math.max(fs, day + whS); + const e = Math.min(fe, day + whE); + for (let t = s; t + durMs <= e; t = addMinutes(new Date(t), durationMinutes).getTime()) { + slots.push({ start: iso(t), end: iso(t + durMs) }); + } + } + } + + return slots; +} +export default findAvailableSlots; +// Generation time: 28.829s +// Result: PASS \ No newline at end of file diff --git a/tests/8_json_validator/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/8_json_validator/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..fc4443d --- /dev/null +++ b/tests/8_json_validator/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,13 @@ +const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://cdn.jsdelivr.net/npm/ajv@8/+esm'); + const ajv = new Ajv({ allErrors: true, strict: false }); + const validate = ajv.compile(schema); + const valid = validate(data); + return { + valid, + errors: valid ? [] : validate.errors.map(e => `${e.instancePath || '/'} ${e.message}`) + }; +}; +export default validateJSON; +// Generation time: 2.748s +// Result: PASS \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs/anthropic_claude-opus-4.7 EFF_medium.js b/tests/9_stream_visualizer/outputs/anthropic_claude-opus-4.7 EFF_medium.js new file mode 100644 index 0000000..8ebf47e --- /dev/null +++ b/tests/9_stream_visualizer/outputs/anthropic_claude-opus-4.7 EFF_medium.js @@ -0,0 +1,31 @@ +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 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: 6.848s +// Result: PASS \ No newline at end of file