From 75b92c832f370d9af7f6a941b9abfa3fe8b51129 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 19 Feb 2026 16:23:35 +0000 Subject: [PATCH] Docs: Update benchmark for google/gemini-3.1-pro-preview --- .../outputs/google_gemini-3.1-pro-preview.js | 9 ++++ .../outputs/google_gemini-3.1-pro-preview.js | 12 ++++++ .../outputs/google_gemini-3.1-pro-preview.js | 33 ++++++++++++++ .../outputs/google_gemini-3.1-pro-preview.js | 27 ++++++++++++ .../outputs/google_gemini-3.1-pro-preview.js | 17 ++++++++ .../outputs/google_gemini-3.1-pro-preview.js | 9 ++++ .../outputs/google_gemini-3.1-pro-preview.js | 7 +++ .../outputs/google_gemini-3.1-pro-preview.js | 7 +++ .../outputs/google_gemini-3.1-pro-preview.js | 13 ++++++ .../outputs/google_gemini-3.1-pro-preview.js | 43 +++++++++++++++++++ .../outputs/google_gemini-3.1-pro-preview.js | 13 ++++++ .../outputs/google_gemini-3.1-pro-preview.js | 29 +++++++++++++ 12 files changed, 219 insertions(+) create mode 100644 tests/10_scrypt_hash/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/11_geospatial/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/12_mst_pipeline/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/1_dijkstra/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/2_convex_hull/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/3_lis/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/4_transpiler/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/5_markdown_parser/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/6_csv_processor/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/7_scheduler/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/8_json_validator/outputs/google_gemini-3.1-pro-preview.js create mode 100644 tests/9_stream_visualizer/outputs/google_gemini-3.1-pro-preview.js diff --git a/tests/10_scrypt_hash/outputs/google_gemini-3.1-pro-preview.js b/tests/10_scrypt_hash/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..e4582cf --- /dev/null +++ b/tests/10_scrypt_hash/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,9 @@ +export async function hashPassword(p, s) { + const { scrypt } = await import('https://esm.sh/scrypt-js'); + const e = new TextEncoder(); + const h = await scrypt(e.encode(p), e.encode(s), 1024, 8, 1, 32); + return [...h].map(b => b.toString(16).padStart(2, '0')).join(''); +} +export default hashPassword; +// Generation time: 17.304s +// Result: PASS \ No newline at end of file diff --git a/tests/11_geospatial/outputs/google_gemini-3.1-pro-preview.js b/tests/11_geospatial/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..b9fe3ad --- /dev/null +++ b/tests/11_geospatial/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,12 @@ +const analyzeGPS = async (r, b) => { + const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); + + const v = r + .filter(p => t.booleanPointInPolygon(t.point(p.loc), b, { ignoreBoundary: true })) + .sort((x, y) => x.ts - y.ts); + + return v.length < 2 ? 0 : +t.length(t.lineString(v.map(p => p.loc))).toFixed(2); +}; +export default analyzeGPS; +// Generation time: 23.653s +// Result: PASS \ No newline at end of file diff --git a/tests/12_mst_pipeline/outputs/google_gemini-3.1-pro-preview.js b/tests/12_mst_pipeline/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..8786be2 --- /dev/null +++ b/tests/12_mst_pipeline/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,33 @@ +async function computeMST(str) { + const [T, M, X] = await Promise.all( + ['smol-toml', 'mnemonist', 'text-table'].map(m => import(`https://esm.sh/${m}`)) + ); + const Q = new M.Heap((a, b) => a.weight - b.weight); + const S = new Set(), p = {}, r = {}; + + for (const e of T.parse(str).edges ?? []) { + Q.push(e); + S.add(e.from).add(e.to); + } + + S.forEach(x => (p[x] = x, r[x] = 0)); + + const f = x => p[x] === x ? x : (p[x] = f(p[x])); + const A = [['From', 'To', 'Weight']]; + let W = 0, c = 0, L = S.size - 1; + + while (Q.size && c < L) { + const e = Q.pop(), u = f(e.from), v = f(e.to); + if (u !== v) { + r[u] < r[v] ? p[u] = v : r[u] > r[v] ? p[v] = u : (p[v] = u, r[u]++); + A.push([e.from, e.to, `${e.weight}`]); + W += e.weight; + c++; + } + } + + return { table: X.default(A), totalWeight: W }; +} +export default computeMST; +// Generation time: 32.324s +// Result: PASS \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/google_gemini-3.1-pro-preview.js b/tests/1_dijkstra/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..b274e3f --- /dev/null +++ b/tests/1_dijkstra/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,27 @@ +export const findShortestPath = async (g, s, e) => { + const { default: PQ } = await import("https://esm.sh/js-priority-queue"); + const q = new PQ({ comparator: (a, b) => a[1] - b[1] }); + const d = { [s]: 0 }; + + q.queue([s, 0]); + + while (q.length) { + const [u, w] = q.dequeue(); + + if (u === e) return w; + if (w > d[u]) continue; + + for (const [v, c] of Object.entries(g[u] ?? {})) { + const a = w + c; + if (a < (d[v] ?? Infinity)) { + d[v] = a; + q.queue([v, a]); + } + } + } + + return Infinity; +}; +export default findShortestPath; +// Generation time: 19.792s +// Result: PASS \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/google_gemini-3.1-pro-preview.js b/tests/2_convex_hull/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..edad7e9 --- /dev/null +++ b/tests/2_convex_hull/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,17 @@ +const findConvexHull = async p => { + const { uniqWith, isEqual, sortBy } = await import('https://esm.sh/lodash-es'); + const s = sortBy(uniqWith(p, isEqual), ['x', 'y']); + if (s.length < 3) return s; + + const cw = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) <= 0; + + const fn = a => a.reduce((h, pt) => { + while (h.length > 1 && cw(h.at(-2), h.at(-1), pt)) h.pop(); + return h.push(pt), h; + }, []); + + return [...fn(s).slice(0, -1), ...fn([...s].reverse()).slice(0, -1)]; +}; +export default findConvexHull; +// Generation time: 39.797s +// Result: PASS \ No newline at end of file diff --git a/tests/3_lis/outputs/google_gemini-3.1-pro-preview.js b/tests/3_lis/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..d78622d --- /dev/null +++ b/tests/3_lis/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,9 @@ +export const findLISLength = async a => { + const { bisectLeft } = await import("https://esm.sh/d3-array"); + const s = []; + for (const x of a) s[bisectLeft(s, x)] = x; + return s.length; +}; +export default findLISLength; +// Generation time: 15.537s +// Result: PASS \ No newline at end of file diff --git a/tests/4_transpiler/outputs/google_gemini-3.1-pro-preview.js b/tests/4_transpiler/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..8f6cf65 --- /dev/null +++ b/tests/4_transpiler/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,7 @@ +const renderTemplate = async (template, data) => { + const { default: hbs } = await import("https://esm.sh/handlebars"); + return hbs.compile(template)(data); +}; +export default renderTemplate; +// Generation time: 14.818s +// Result: PASS \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs/google_gemini-3.1-pro-preview.js b/tests/5_markdown_parser/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..8ce982f --- /dev/null +++ b/tests/5_markdown_parser/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,7 @@ +const parseMarkdown = async m => { + const { parse } = await import('https://cdn.jsdelivr.net/npm/marked/+esm'); + return parse(m); +}; +export default parseMarkdown; +// Generation time: 23.960s +// Result: PASS \ No newline at end of file diff --git a/tests/6_csv_processor/outputs/google_gemini-3.1-pro-preview.js b/tests/6_csv_processor/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..79dbac2 --- /dev/null +++ b/tests/6_csv_processor/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,13 @@ +export const processCSV = async (c, { filterColumn: f, filterValue: v, groupBy: g, aggregateColumn: a, operation: o }) => { + const { default: P } = await import('https://esm.sh/papaparse'); + return [...P.parse(c, { header: true, skipEmptyLines: true }).data + .filter(r => r[f] == v) + .reduce((m, r) => { + const k = r[g], n = +r[a] || 0, x = m.get(k) || { s: 0, c: 0 }; + return m.set(k, { s: x.s + n, c: x.c + 1 }); + }, new Map())] + .map(([k, x]) => ({ [g]: k, result: o == 'count' ? x.c : o == 'sum' ? x.s : x.s / x.c })); +}; +export default processCSV; +// Generation time: 50.753s +// Result: PASS \ No newline at end of file diff --git a/tests/7_scheduler/outputs/google_gemini-3.1-pro-preview.js b/tests/7_scheduler/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..15f0c96 --- /dev/null +++ b/tests/7_scheduler/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,43 @@ +const findAvailableSlots = async (c1, c2, { durationMinutes: dM, searchRange: sR, workHours: wH }) => { + const [{ default: D }, { default: U }] = await Promise.all([ + import('https://esm.sh/dayjs'), + import('https://esm.sh/dayjs/plugin/utc') + ]); + D.extend(U); + + let m = [], f = [], a = [], dm = dM * 6e4, + c = D.utc(sR.start).valueOf(), + e = D.utc(sR.end).valueOf(), + [sH, sM] = wH.start.split(':'), + [eH, eM] = wH.end.split(':'); + + [...c1, ...c2] + .map(x => ({ s: D.utc(x.start).valueOf(), e: D.utc(x.end).valueOf() })) + .sort((x, y) => x.s - y.s) + .forEach(x => { + let l = m[m.length - 1]; + !l || l.e < x.s ? m.push(x) : l.e = Math.max(l.e, x.e); + }); + + m.forEach(x => { + if (x.s > c && x.s <= e) f.push({ s: c, e: Math.min(x.s, e) }); + c = Math.max(c, x.e); + }); + if (c < e) f.push({ s: c, e }); + + f.forEach(x => { + for (let p = x.s; p + dm <= x.e; p += dm) { + let t = D.utc(p), + w1 = t.clone().hour(sH).minute(sM).second(0).millisecond(0).valueOf(), + w2 = t.clone().hour(eH).minute(eM).second(0).millisecond(0).valueOf(); + if (p >= w1 && p + dm <= w2) { + a.push({ start: t.toISOString(), end: D.utc(p + dm).toISOString() }); + } + } + }); + + return a; +}; +export default findAvailableSlots; +// Generation time: 39.017s +// Result: PASS \ No newline at end of file diff --git a/tests/8_json_validator/outputs/google_gemini-3.1-pro-preview.js b/tests/8_json_validator/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..e8e0f9d --- /dev/null +++ b/tests/8_json_validator/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,13 @@ +export const validateJSON = async (d, s) => { + const { default: A } = await import("https://esm.sh/ajv@8"); + const v = new A({ allErrors: true }).compile(s); + const k = v(d); + + return { + valid: k, + errors: k ? [] : v.errors.map(e => `${e.instancePath || "/"} ${e.message}`.trim()) + }; +}; +export default validateJSON; +// Generation time: 16.896s +// Result: PASS \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs/google_gemini-3.1-pro-preview.js b/tests/9_stream_visualizer/outputs/google_gemini-3.1-pro-preview.js new file mode 100644 index 0000000..0a134f7 --- /dev/null +++ b/tests/9_stream_visualizer/outputs/google_gemini-3.1-pro-preview.js @@ -0,0 +1,29 @@ +export const createStreamVisualizer = async ( + stream, + { maxPoints, alpha, width, height, yDomain } +) => { + const { scaleLinear, line } = await import("https://cdn.jsdelivr.net/npm/d3@7/+esm"); + const data = []; + let ema; + + for await (const { timestamp, value } of stream) { + ema = data.length ? alpha * value + (1 - alpha) * ema : value; + data.push({ timestamp, value, ema }); + data.length > maxPoints && data.shift(); + } + + if (!data.length) return { data, path: "" }; + + const x = scaleLinear([data[0].timestamp, data.at(-1).timestamp], [0, width]); + const y = scaleLinear(yDomain, [height, 0]); + + return { + data, + path: line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema))(data) + }; +}; +export default createStreamVisualizer; +// Generation time: 42.202s +// Result: PASS \ No newline at end of file