From 0bea7a0d266e9227a6d597ea975b79e293a3453e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Dec 2025 16:44:44 +0000 Subject: [PATCH] Docs: Update benchmark for google/gemini-3-flash-preview --- .../outputs/google_gemini-3-flash-preview.js | 18 ++++++ .../outputs/google_gemini-3-flash-preview.js | 17 ++++++ .../outputs/google_gemini-3-flash-preview.js | 28 ++++++++++ .../outputs/google_gemini-3-flash-preview.js | 27 +++++++++ .../outputs/google_gemini-3-flash-preview.js | 16 ++++++ .../outputs/google_gemini-3-flash-preview.js | 7 +++ .../outputs/google_gemini-3-flash-preview.js | 11 ++++ .../outputs/google_gemini-3-flash-preview.js | 34 +++++++++++ .../outputs/google_gemini-3-flash-preview.js | 56 +++++++++++++++++++ .../outputs/google_gemini-3-flash-preview.js | 16 ++++++ .../outputs/google_gemini-3-flash-preview.js | 33 +++++++++++ 11 files changed, 263 insertions(+) create mode 100644 tests/10_scrypt_hash/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/11_geospatial/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/1_dijkstra/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/2_convex_hull/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/3_lis/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/4_transpiler/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/5_markdown_parser/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/6_csv_processor/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/7_scheduler/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/8_json_validator/outputs/google_gemini-3-flash-preview.js create mode 100644 tests/9_stream_visualizer/outputs/google_gemini-3-flash-preview.js diff --git a/tests/10_scrypt_hash/outputs/google_gemini-3-flash-preview.js b/tests/10_scrypt_hash/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..9f5058b --- /dev/null +++ b/tests/10_scrypt_hash/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,18 @@ +const hashPassword = async (password, salt) => { + const { scrypt } = await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.1.7/+esm'); + const encoder = new TextEncoder(); + + const derivedKey = await scrypt( + encoder.encode(password), + encoder.encode(salt), + 1024, + 8, + 1, + 32 + ); + + return Array.from(derivedKey, byte => byte.toString(16).padStart(2, '0')).join(''); +}; +export default hashPassword; +// Generation time: 9.228s +// Result: FAIL \ No newline at end of file diff --git a/tests/11_geospatial/outputs/google_gemini-3-flash-preview.js b/tests/11_geospatial/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..3c6912c --- /dev/null +++ b/tests/11_geospatial/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,17 @@ +export async function analyzeGPS(readings, boundary) { + const T = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm'); + + const pts = readings + .filter(({ loc }) => T.booleanPointInPolygon(loc, boundary)) + .sort((a, b) => a.ts - b.ts) + .map(({ loc }) => loc); + + if (pts.length < 2) return 0; + + const len = T.length(T.lineString(pts), { units: 'kilometers' }); + + return Math.round(len * 100) / 100; +} +export default analyzeGPS; +// Generation time: 9.884s +// Result: PASS \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/google_gemini-3-flash-preview.js b/tests/1_dijkstra/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..992119d --- /dev/null +++ b/tests/1_dijkstra/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,28 @@ +export const findShortestPath = async (graph, start, end) => { + const { default: PQ } = await import('https://cdn.skypack.dev/js-priority-queue'); + + const dists = { [start]: 0 }; + const pq = new PQ({ comparator: (a, b) => a.w - b.w }); + + pq.queue({ n: start, w: 0 }); + + while (pq.length) { + const { n, w } = pq.dequeue(); + + if (n === end) return w; + if (w > (dists[n] ?? Infinity)) continue; + + for (const [neighbor, weight] of Object.entries(graph[n] ?? {})) { + const total = w + weight; + if (total < (dists[neighbor] ?? Infinity)) { + dists[neighbor] = total; + pq.queue({ n: neighbor, w: total }); + } + } + } + + return Infinity; +}; +export default findShortestPath; +// Generation time: 12.594s +// Result: PASS \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/google_gemini-3-flash-preview.js b/tests/2_convex_hull/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..995bf22 --- /dev/null +++ b/tests/2_convex_hull/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,27 @@ +export const findConvexHull = async (points) => { + const _ = (await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm')).default; + const sorted = _.sortBy(_.uniqWith(points, _.isEqual), ['x', 'y']); + + if (sorted.length < 3) return sorted; + + const crossProduct = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); + + const buildChain = (arr) => { + const chain = []; + for (const p of arr) { + while (chain.length >= 2 && crossProduct(chain[chain.length - 2], chain[chain.length - 1], p) <= 0) { + chain.pop(); + } + chain.push(p); + } + return chain; + }; + + const lower = buildChain(sorted); + const upper = buildChain([...sorted].reverse()); + + return [...lower.slice(0, -1), ...upper.slice(0, -1)]; +}; +export default findConvexHull; +// Generation time: 12.985s +// Result: PASS \ No newline at end of file diff --git a/tests/3_lis/outputs/google_gemini-3-flash-preview.js b/tests/3_lis/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..18eb313 --- /dev/null +++ b/tests/3_lis/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,16 @@ +const findLISLength = async (nums) => { + const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array@3'); + const tails = []; + + for (const x of nums) { + const i = bisectLeft(tails, x); + tails[i] = x; + } + + return tails.length; +}; + + +export default findLISLength; +// Generation time: 13.472s +// Result: PASS \ No newline at end of file diff --git a/tests/4_transpiler/outputs/google_gemini-3-flash-preview.js b/tests/4_transpiler/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..dbc4b18 --- /dev/null +++ b/tests/4_transpiler/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,7 @@ +const renderTemplate = async (template, data) => { + const { default: hb } = await import('https://esm.sh/handlebars'); + return hb.compile(template)(data); +}; +export default renderTemplate; +// Generation time: 14.517s +// Result: PASS \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs/google_gemini-3-flash-preview.js b/tests/5_markdown_parser/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..b35b867 --- /dev/null +++ b/tests/5_markdown_parser/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,11 @@ +const parseMarkdown = async (md) => { + const [{ marked }, { default: sanitize }] = await Promise.all([ + import('https://esm.sh/marked'), + import('https://esm.sh/dompurify') + ]); + + return sanitize.sanitize(marked.parse(md)); +}; +export default parseMarkdown; +// Generation time: 7.966s +// Result: PASS \ No newline at end of file diff --git a/tests/6_csv_processor/outputs/google_gemini-3-flash-preview.js b/tests/6_csv_processor/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..8ab7c43 --- /dev/null +++ b/tests/6_csv_processor/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,34 @@ +export const processCSV = async (csv, { filterColumn, filterValue, groupBy, aggregateColumn, operation }) => { + const [{ parse }, { groupBy: group, sum: total }] = await Promise.all([ + import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/+esm'), + import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm') + ]); + + const { data } = parse(csv, { + header: true, + skipEmptyLines: true + }); + + const filtered = data.filter(r => r[filterColumn] == filterValue); + const collections = group(filtered, groupBy); + + return Object.entries(collections).map(([key, rows]) => { + const values = rows.map(r => +r[aggregateColumn] || 0); + const s = total(values); + const n = values.length; + + const calculations = { + sum: s, + avg: s / n, + count: n + }; + + return { + [groupBy]: key, + result: calculations[operation] + }; + }); +}; +export default processCSV; +// Generation time: 41.061s +// Result: FAIL \ No newline at end of file diff --git a/tests/7_scheduler/outputs/google_gemini-3-flash-preview.js b/tests/7_scheduler/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..b7a921e --- /dev/null +++ b/tests/7_scheduler/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,56 @@ +export async function findAvailableSlots(cal1, cal2, { durationMinutes, searchRange, workHours }) { + const dayjs = (await import('https://cdn.skypack.dev/dayjs')).default; + const utc = (await import('https://cdn.skypack.dev/dayjs/plugin/utc')).default; + dayjs.extend(utc); + + const u = (v) => dayjs.utc(v); + const sR = u(searchRange.start); + const eR = u(searchRange.end); + const [sh, sm] = workHours.start.split(':'); + const [eh, em] = workHours.end.split(':'); + + let blocked = [...cal1, ...cal2].map((b) => ({ + s: u(b.start), + e: u(b.end) + })); + + for (let c = sR.startOf('d'); c <= eR; c = c.add(1, 'd')) { + blocked.push( + { s: c, e: c.set('h', sh).set('m', sm) }, + { s: c.set('h', eh).set('m', em), e: c.add(1, 'd') } + ); + } + + const merged = blocked + .map((b) => ({ + s: b.s < sR ? sR : b.s, + e: b.e > eR ? eR : b.e + })) + .filter((b) => b.s < b.e) + .sort((a, b) => a.s - b.s) + .reduce((acc, b) => { + const p = acc[acc.length - 1]; + p && b.s <= p.e ? (p.e = b.e > p.e ? b.e : p.e) : acc.push(b); + return acc; + }, []); + + const avail = []; + let cursor = sR; + + [...merged, { s: eR, e: eR }].forEach((b) => { + while (cursor.add(durationMinutes, 'm') <= b.s) { + const next = cursor.add(durationMinutes, 'm'); + avail.push({ + start: cursor.toISOString(), + end: next.toISOString() + }); + cursor = next; + } + if (b.e > cursor) cursor = b.e; + }); + + return avail; +} +export default findAvailableSlots; +// Generation time: 35.904s +// Result: PASS \ No newline at end of file diff --git a/tests/8_json_validator/outputs/google_gemini-3-flash-preview.js b/tests/8_json_validator/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..f19a6de --- /dev/null +++ b/tests/8_json_validator/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,16 @@ +export const validateJSON = async (data, schema) => { + const { default: Ajv } = await import('https://cdn.jsdelivr.net/npm/ajv@8.12.0/+esm'); + const ajv = new Ajv({ allErrors: true, strict: false }); + const validate = ajv.compile(schema); + const isValid = validate(data); + + return { + valid: isValid, + errors: isValid ? [] : validate.errors.map(({ instancePath, message }) => + `${instancePath || 'root'} ${message}`.trim() + ) + }; +}; +export default validateJSON; +// Generation time: 6.123s +// Result: PASS \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs/google_gemini-3-flash-preview.js b/tests/9_stream_visualizer/outputs/google_gemini-3-flash-preview.js new file mode 100644 index 0000000..40e4992 --- /dev/null +++ b/tests/9_stream_visualizer/outputs/google_gemini-3-flash-preview.js @@ -0,0 +1,33 @@ +export async function createStreamVisualizer(asyncIterable, { maxPoints, alpha, width, height, yDomain }) { + const d3 = await import("https://cdn.skypack.dev/d3@7"); + let data = []; + let ema = null; + + for await (const { timestamp, value } of asyncIterable) { + 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 lineGenerator = d3.line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)); + + return { + data, + path: lineGenerator(data) + }; +} +export default createStreamVisualizer; +// Generation time: 11.081s +// Result: PASS \ No newline at end of file