From 3983c8eb1ac6d05345429075f38578e2356d790b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 23 Dec 2025 02:41:05 +0000 Subject: [PATCH] Docs: Update benchmark for minimax/minimax-m2.1 --- .../outputs/minimax_minimax-m2.1.js | 13 +++ .../outputs/minimax_minimax-m2.1.js | 12 +++ .../outputs/minimax_minimax-m2.1.js | 34 +++++++ .../outputs/minimax_minimax-m2.1.js | 32 +++++++ tests/3_lis/outputs/minimax_minimax-m2.1.js | 13 +++ .../outputs/minimax_minimax-m2.1.js | 7 ++ .../outputs/minimax_minimax-m2.1.js | 11 +++ .../outputs/minimax_minimax-m2.1.js | 33 +++++++ .../outputs/minimax_minimax-m2.1.js | 94 +++++++++++++++++++ .../outputs/minimax_minimax-m2.1.js | 23 +++++ .../outputs/minimax_minimax-m2.1.js | 43 +++++++++ 11 files changed, 315 insertions(+) create mode 100644 tests/10_scrypt_hash/outputs/minimax_minimax-m2.1.js create mode 100644 tests/11_geospatial/outputs/minimax_minimax-m2.1.js create mode 100644 tests/1_dijkstra/outputs/minimax_minimax-m2.1.js create mode 100644 tests/2_convex_hull/outputs/minimax_minimax-m2.1.js create mode 100644 tests/3_lis/outputs/minimax_minimax-m2.1.js create mode 100644 tests/4_transpiler/outputs/minimax_minimax-m2.1.js create mode 100644 tests/5_markdown_parser/outputs/minimax_minimax-m2.1.js create mode 100644 tests/6_csv_processor/outputs/minimax_minimax-m2.1.js create mode 100644 tests/7_scheduler/outputs/minimax_minimax-m2.1.js create mode 100644 tests/8_json_validator/outputs/minimax_minimax-m2.1.js create mode 100644 tests/9_stream_visualizer/outputs/minimax_minimax-m2.1.js diff --git a/tests/10_scrypt_hash/outputs/minimax_minimax-m2.1.js b/tests/10_scrypt_hash/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..6acfb13 --- /dev/null +++ b/tests/10_scrypt_hash/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,13 @@ +async function hashPassword(password, salt) { + const scrypt = (await import("https://cdnjs.cloudflare.com/ajax/libs/scrypt-js/0.0.2/index.js")).scrypt; + const encoder = new TextEncoder(); + const passwordBytes = encoder.encode(password); + const saltBytes = encoder.encode(salt); + const derivedKey = await scrypt(passwordBytes, saltBytes, 1024, 8, 1, 32); + return Array.from(derivedKey) + .map(b => b.toString(16).padStart(2, '0')) + .join(''); +} +export default hashPassword; +// Generation time: 3.507s +// Result: FAIL \ No newline at end of file diff --git a/tests/11_geospatial/outputs/minimax_minimax-m2.1.js b/tests/11_geospatial/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..3159e02 --- /dev/null +++ b/tests/11_geospatial/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,12 @@ +async function analyzeGPS(readings, boundary) { + if (!readings?.length) return 0; + const turf = await import('https://cdn.skypack.dev/@turf/turf'); + const valid = readings.filter(r => turf.booleanPointInPolygon(r.loc, boundary)); + valid.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: 6.167s +// Result: PASS \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/minimax_minimax-m2.1.js b/tests/1_dijkstra/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..7b29d6d --- /dev/null +++ b/tests/1_dijkstra/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,34 @@ +export async function findShortestPath(graph, start, end) { + const { PriorityQueue } = await import("https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.15/+esm"); + + const distances = {}; + const visited = new Set(); + const queue = new PriorityQueue({ comparator: (a, b) => a.distance - b.distance }); + + for (const node in graph) { + distances[node] = Infinity; + } + distances[start] = 0; + queue.enqueue({ node: start, distance: 0 }); + + while (queue.length > 0) { + const { node: current, distance } = queue.dequeue(); + + if (current === end) return distance; + if (visited.has(current)) continue; + visited.add(current); + + for (const [neighbor, weight] of Object.entries(graph[current] || {})) { + const newDistance = distance + weight; + if (newDistance < distances[neighbor]) { + distances[neighbor] = newDistance; + queue.enqueue({ node: neighbor, distance: newDistance }); + } + } + } + + return Infinity; +} +export default findShortestPath; +// Generation time: 4.700s +// Result: FAIL \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/minimax_minimax-m2.1.js b/tests/2_convex_hull/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..c9ab90e --- /dev/null +++ b/tests/2_convex_hull/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,32 @@ +async function findConvexHull(points) { + const _ = await import("https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm"); + + const sortedPoints = _.sortBy([...points], ["x", "y"]); + const uniquePoints = _.uniqWith(sortedPoints, (a, b) => a.x === b.x && a.y === b.y); + + if (uniquePoints.length <= 2) return uniquePoints; + + const crossProduct = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x); + + const lower = []; + for (const point of uniquePoints) { + while (lower.length >= 2 && crossProduct(lower[lower.length - 2], lower[lower.length - 1], point) <= 0) { + lower.pop(); + } + lower.push(point); + } + + const upper = []; + for (let i = uniquePoints.length - 1; i >= 0; i--) { + const point = uniquePoints[i]; + while (upper.length >= 2 && crossProduct(upper[upper.length - 2], upper[upper.length - 1], point) <= 0) { + upper.pop(); + } + upper.push(point); + } + + return [...lower.slice(0, -1), ...upper.slice(0, -1)]; +} +export default findConvexHull; +// Generation time: 11.859s +// Result: FAIL \ No newline at end of file diff --git a/tests/3_lis/outputs/minimax_minimax-m2.1.js b/tests/3_lis/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..c4d4e6c --- /dev/null +++ b/tests/3_lis/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,13 @@ +async function findLISLength(arr) { + const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm'); + const tails = []; + for (const num of arr) { + const idx = bisectLeft(tails, num); + if (idx === tails.length) tails.push(num); + else tails[idx] = num; + } + return tails.length; +} +export default findLISLength; +// Generation time: 4.847s +// Result: PASS \ No newline at end of file diff --git a/tests/4_transpiler/outputs/minimax_minimax-m2.1.js b/tests/4_transpiler/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..e1e191c --- /dev/null +++ b/tests/4_transpiler/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,7 @@ +async function renderTemplate(template, data) { + window.Handlebars || await import('https://cdn.jsdelivr.net/npm/handlebars@4.7.7/dist/handlebars.min.js'); + return window.Handlebars.compile(template)(data); +} +export default renderTemplate; +// Generation time: 42.558s +// Result: FAIL \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs/minimax_minimax-m2.1.js b/tests/5_markdown_parser/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..feb9c2d --- /dev/null +++ b/tests/5_markdown_parser/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,11 @@ +async function parseMarkdown(markdown) { + try { + const { marked } = await import('https://cdn.jsdelivr.net/npm/marked@5.1.0/lib/marked.esm.min.js'); + return marked.parse(markdown); + } catch (error) { + return `

Error parsing markdown: ${error.message}

`; + } +} +export default parseMarkdown; +// Generation time: 10.685s +// Result: PASS \ No newline at end of file diff --git a/tests/6_csv_processor/outputs/minimax_minimax-m2.1.js b/tests/6_csv_processor/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..fb416db --- /dev/null +++ b/tests/6_csv_processor/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,33 @@ +export async function processCSV(csvData, config) { + const { Papa } = await import('https://cdn.skypack.dev/papaparse@5.3.2'); + const { filterColumn, filterValue, groupBy, aggregateColumn, operation } = config; + + const { data } = Papa.parse(csvData, { header: true, skipEmptyLines: true }); + + const groups = data.reduce((acc, row) => { + if (row[filterColumn] != filterValue) return acc; + const key = row[groupBy]; + if (!acc[key]) acc[key] = []; + acc[key].push(row); + return acc; + }, {}); + + return Object.entries(groups).map(([key, rows]) => { + let result; + if (operation === 'count') { + result = rows.length; + } else { + const values = rows.map(r => parseFloat(r[aggregateColumn]) || 0); + if (operation === 'sum') { + result = values.reduce((a, b) => a + b, 0); + } else if (operation === 'avg') { + const sum = values.reduce((a, b) => a + b, 0); + result = sum / values.length; + } + } + return { [groupBy]: key, result }; + }); +} +export default processCSV; +// Generation time: 4.238s +// Result: FAIL \ No newline at end of file diff --git a/tests/7_scheduler/outputs/minimax_minimax-m2.1.js b/tests/7_scheduler/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..ff4b321 --- /dev/null +++ b/tests/7_scheduler/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,94 @@ +export async function findAvailableSlots(calendarA, calendarB, constraints) { + const { durationMinutes, searchRange, workHours } = constraints; + const { parseISO, addMinutes, differenceInMinutes, min, max, formatISO, isAfter, isBefore, isEqual, parse } = await import('https://cdn.jsdelivr.net/npm/date-fns@3.6.0/+esm'); + + const searchStart = parseISO(searchRange.start); + const searchEnd = parseISO(searchRange.end); + const workStart = parse(workHours.start, 'HH:mm', searchStart); + const workEnd = parse(workHours.end, 'HH:mm', searchStart); + + const allBusy = [...calendarA, ...calendarB].map(slot => ({ + start: parseISO(slot.start), + end: parseISO(slot.end) + })).sort((a, b) => a.start - b.start); + + const mergedBusy = []; + for (const slot of allBusy) { + if (!mergedBusy.length || isAfter(slot.start, mergedBusy[mergedBusy.length - 1].end)) { + mergedBusy.push({ start: slot.start, end: slot.end }); + } else { + mergedBusy[mergedBusy.length - 1].end = max([mergedBusy[mergedBusy.length - 1].end, slot.end]); + } + } + + const freePeriods = []; + let currentStart = searchStart; + + for (const busy of mergedBusy) { + if (isBefore(currentStart, busy.start)) { + freePeriods.push({ start: currentStart, end: busy.start }); + } + currentStart = max([currentStart, busy.end]); + } + + if (isBefore(currentStart, searchEnd)) { + freePeriods.push({ start: currentStart, end: searchEnd }); + } + + const slots = []; + + for (const period of freePeriods) { + const periodStart = max([period.start, searchStart]); + const periodEnd = min([period.end, searchEnd]); + + let slotStart = periodStart; + + while (true) { + const slotEnd = addMinutes(slotStart, durationMinutes); + + if (isAfter(slotEnd, periodEnd) || isAfter(slotEnd, searchEnd)) { + break; + } + + const slotWorkStart = new Date(slotStart); + const slotWorkEnd = new Date(slotStart); + slotWorkStart.setUTCHours(workStart.getUTCHours(), workStart.getUTCMinutes(), 0, 0); + slotWorkEnd.setUTCHours(workEnd.getUTCHours(), workEnd.getUTCMinutes(), 0, 0); + + const adjustedSlotStart = max([slotStart, slotWorkStart]); + + if (differenceInMinutes(slotEnd, adjustedSlotStart) >= durationMinutes) { + const finalSlotStart = adjustedSlotStart; + const finalSlotEnd = addMinutes(finalSlotStart, durationMinutes); + + if (!isAfter(finalSlotEnd, periodEnd) && !isAfter(finalSlotEnd, searchEnd) && !isAfter(finalSlotEnd, slotWorkEnd)) { + slots.push({ start: formatISO(finalSlotStart), end: formatISO(finalSlotEnd) }); + } + } + + slotStart = addMinutes(slotStart, durationMinutes); + } + } + + const sortedSlots = slots.sort((a, b) => parseISO(a.start) - parseISO(b.start)); + + const nonOverlappingSlots = []; + let lastEnd = null; + + for (const slot of sortedSlots) { + const slotStart = parseISO(slot.start); + const slotEnd = parseISO(slot.end); + + if (!lastEnd || !isBefore(slotStart, lastEnd)) { + if (!lastEnd || isAfter(slotStart, lastEnd)) { + nonOverlappingSlots.push(slot); + lastEnd = slotEnd; + } + } + } + + return nonOverlappingSlots; +} +export default findAvailableSlots; +// Generation time: 14.885s +// Result: FAIL \ No newline at end of file diff --git a/tests/8_json_validator/outputs/minimax_minimax-m2.1.js b/tests/8_json_validator/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..da8a348 --- /dev/null +++ b/tests/8_json_validator/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,23 @@ +async function validateJSON(data, schema) { + const Ajv = (await import('https://cdn.jsdelivr.net/npm/ajv@8.12.0/dist/ajv2019.min.js')).default; + + const ajv = new Ajv({ allErrors: true, strict: false }); + const validate = ajv.compile(schema); + const valid = validate(data); + + if (valid) { + return { valid: true, errors: [] }; + } + + const errors = validate.errors.map(error => { + const message = `${error.instancePath} ${error.message}`; + return error.params && error.params.allowedValues + ? `${message} (allowed: ${error.params.allowedValues.join(', ')})` + : message; + }); + + return { valid: false, errors }; +} +export default validateJSON; +// Generation time: 6.888s +// Result: FAIL \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs/minimax_minimax-m2.1.js b/tests/9_stream_visualizer/outputs/minimax_minimax-m2.1.js new file mode 100644 index 0000000..67f07e3 --- /dev/null +++ b/tests/9_stream_visualizer/outputs/minimax_minimax-m2.1.js @@ -0,0 +1,43 @@ +export 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 point of asyncIterable) { + const { timestamp, value } = point; + const ema = prevEma === null + ? value + : alpha * value + (1 - alpha) * prevEma; + prevEma = ema; + + data.push({ timestamp, value, ema }); + if (data.length > maxPoints) { + data.shift(); + } + } + + if (data.length === 0) { + return { data: [], path: '' }; + } + + const [first, last] = [data[0], data[data.length - 1]]; + const xScale = d3.scaleLinear() + .domain([first.timestamp, last.timestamp]) + .range([0, width]); + + const yScale = d3.scaleLinear() + .domain(yDomain) + .range([height, 0]); + + const path = d3.line() + .x(d => xScale(d.timestamp)) + .y(d => yScale(d.ema)) + .curve(d3.curveLinear)(data); + + return { data, path }; +} +export default createStreamVisualizer; +// Generation time: 20.632s +// Result: PASS \ No newline at end of file