From 24de0a1a87dbcd54b3ec29fd730dc11304b55773 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 16 Nov 2025 00:31:49 +0000 Subject: [PATCH] Docs: Update benchmark for openrouter/sherlock-dash-alpha --- results.json | 11 +++ .../outputs/openrouter_sherlock-dash-alpha.js | 20 ++++++ .../outputs/openrouter_sherlock-dash-alpha.js | 16 +++++ .../outputs/openrouter_sherlock-dash-alpha.js | 12 ++++ .../outputs/openrouter_sherlock-dash-alpha.js | 5 ++ .../outputs/openrouter_sherlock-dash-alpha.js | 35 ++++++++++ .../outputs/openrouter_sherlock-dash-alpha.js | 2 + .../outputs/openrouter_sherlock-dash-alpha.js | 67 +++++++++++++++++++ .../outputs/openrouter_sherlock-dash-alpha.js | 13 ++++ .../outputs/openrouter_sherlock-dash-alpha.js | 26 +++++++ 10 files changed, 207 insertions(+) create mode 100644 tests/1_dijkstra/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/2_convex_hull/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/3_lis/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/4_determinant/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/5_markdown_parser/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/6_csv_processor/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/7_scheduler/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/8_json_validator/outputs/openrouter_sherlock-dash-alpha.js create mode 100644 tests/9_stream_visualizer/outputs/openrouter_sherlock-dash-alpha.js diff --git a/results.json b/results.json index caff7cf..c05eb45 100644 --- a/results.json +++ b/results.json @@ -64,5 +64,16 @@ "7_scheduler": 82.133111714, "8_json_validator": 31.42142794699996, "9_stream_visualizer": 35.74114956699999 + }, + "openrouter/sherlock-dash-alpha": { + "1_dijkstra": 2.7058817040000003, + "2_convex_hull": 3.9343546879999995, + "3_lis": 1.2894778209999995, + "4_determinant": 0.611742537, + "5_markdown_parser": 4.020213965999999, + "6_csv_processor": 3.107556931000001, + "7_scheduler": 7.806581231, + "8_json_validator": 1.4850442509999993, + "9_stream_visualizer": 2.5679872179999985 } } \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/openrouter_sherlock-dash-alpha.js b/tests/1_dijkstra/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..8380d82 --- /dev/null +++ b/tests/1_dijkstra/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,20 @@ +async function findShortestPath(graph, start, end) { + const { PriorityQueue } = await import('https://cdn.skypack.dev/js-priority-queue'); + const pq = new PriorityQueue({ comparator: (a, b) => a[1] - b[1] }); + const dist = {}; Object.keys(graph).forEach(n => dist[n] = Infinity); dist[start] = 0; + pq.queue([start, 0]); + while (!pq.isEmpty()) { + const [u, d] = pq.dequeue(); + if (u === end) return d; + if (d > dist[u]) continue; + for (const [v, w] of Object.entries(graph[u] || {})) { + const nd = d + w; + if (nd < dist[v]) { + dist[v] = nd; + pq.queue([v, nd]); + } + } + } + return Infinity; +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/2_convex_hull/outputs/openrouter_sherlock-dash-alpha.js b/tests/2_convex_hull/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..cc32fc5 --- /dev/null +++ b/tests/2_convex_hull/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,16 @@ +async function findConvexHull(points) { + const {_, default: _} = await import('https://cdn.skypack.dev/lodash-es'); + const pts = _([...new Set(points.map(p=>`${p.x},${p.y}`))].map(s=>s.split(',').map(Number)).map(([x,y])=>({x,y}))); + const ccw=(a,b,c)=> (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x); + const build=(pts,low)=> { + const hull=[]; + for(let p of pts){ + while(hull.length>1&&ccw(hull[hull.length-2],hull[hull.length-1],p)<=0) hull.pop(); + hull.push(p); + } + return hull.slice(0,low?hull.length:hull.length-1); + }; + if(pts.length<3) return pts; + return [...build(pts.sort((a,b)=>a.x-b.x||a.y-b.y),1),...build(pts.slice().reverse(),0)]; +} +export default findConvexHull; \ No newline at end of file diff --git a/tests/3_lis/outputs/openrouter_sherlock-dash-alpha.js b/tests/3_lis/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..27c0dc5 --- /dev/null +++ b/tests/3_lis/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,12 @@ +async function findLISLength(arr) { + const {bisectLeft} = await import('https://cdn.skypack.dev/d3-array'); + if(!arr.length) return 0; + const tails = []; + for(const x of arr) { + const i = bisectLeft(tails, x); + if(i === tails.length) tails.push(x); + else tails[i] = x; + } + return tails.length; +} +export default findLISLength; \ No newline at end of file diff --git a/tests/4_determinant/outputs/openrouter_sherlock-dash-alpha.js b/tests/4_determinant/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..d2c12f3 --- /dev/null +++ b/tests/4_determinant/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,5 @@ +const calculateDeterminant=async m=>{ + const{math}=await import('https://cdn.jsdelivr.net/npm/mathjs@12.4.2/lib/browser/math.js'); + return math.det(m); +}; +export default calculateDeterminant; \ No newline at end of file diff --git a/tests/5_markdown_parser/outputs/openrouter_sherlock-dash-alpha.js b/tests/5_markdown_parser/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..39e1b9e --- /dev/null +++ b/tests/5_markdown_parser/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,35 @@ +async function parseMarkdown(md) { + const { default: marked } = await import('https://cdn.skypack.dev/marked@14.1.2'); + marked.use({ + breaks: true, + gfm: true, + async tokenize(src) { + const tokens = marked.lexer(src); + for (const token of tokens) { + if (token.type === 'list') { + token.ordered = token.ordered || false; + token.loose = !!token.items.find(item => item.text.includes('\n')); + } + } + return tokens; + }, + renderer: { + heading(text, level) { return `${text}`; }, + strong(text) { return `${text}`; }, + em(text) { return `${text}`; }, + codespan(text) { return `${text}`; }, + link(href, title, text) { return `${text}`; }, + code(code, infostring) { + const lang = (infostring || '').match(/^([a-z0-9]+)/i); + return `
${code}
`; + }, + list(body, ordered) { + const type = ordered ? 'ol' : 'ul'; + return `<${type}>${body}`; + }, + blockquote(quote) { return `
${quote}
`; } + } + }); + return marked.parse(md); +} +export default parseMarkdown; \ No newline at end of file diff --git a/tests/6_csv_processor/outputs/openrouter_sherlock-dash-alpha.js b/tests/6_csv_processor/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..5e01fef --- /dev/null +++ b/tests/6_csv_processor/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,2 @@ +async function processCSV(csv,cfg){const{Papa}=await import('https://cdn.jsdelivr.net/npm/papaparse@5.4.1/papaparse.min.js');const{groupBy,mean,sum}=await import('https://cdn.jsdelivr.net/npm/@jazzband/lodash-deep@1.1.3/lodash-deep.min.js');const{data,meta}=Papa.parse(csv,{header:!0});const rows=data.filter(r=>r[cfg.filterColumn]==cfg.filterValue);const num=(v)=>+v||0;const grouped=groupBy(rows,r=>r[cfg.groupBy]);return Object.entries(grouped).map(([k,v])=>({ [cfg.groupBy]:k,result:cfg.operation==='sum'?sum(v.map(r=>num(r[cfg.aggregateColumn]))):cfg.operation==='avg'?mean(v.map(r=>num(r[cfg.aggregateColumn]))):v.length}))} +export default processCSV; \ No newline at end of file diff --git a/tests/7_scheduler/outputs/openrouter_sherlock-dash-alpha.js b/tests/7_scheduler/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..a3fb81e --- /dev/null +++ b/tests/7_scheduler/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,67 @@ +async function findAvailableSlots(cal1, cal2, {durationMinutes, searchRange, workHours}) { + const {luxon: {DateTime, Interval}} = await import('https://cdn.skypack.dev/luxon'); + + const workStart = DateTime.fromFormat(workHours.start, 'HH:mm'); + const workEnd = DateTime.fromFormat(workHours.end, 'HH:mm'); + const searchStart = DateTime.fromISO(searchRange.start); + const searchEnd = DateTime.fromISO(searchRange.end); + const duration = Duration.fromObject({minutes: durationMinutes}); + + const parseCal = cal => cal.map(s => ({ + start: DateTime.fromISO(s.start), + end: DateTime.fromISO(s.end) + })).filter(s => s.start < s.end); + + const mergeOverlaps = slots => slots + .sort((a,b) => a.start - b.end) + .reduce((merged, curr) => { + const last = merged[merged.length - 1]; + if (!last || last.end < curr.start) return [...merged, curr]; + last.end = Math.max(last.end, curr.end); + return merged; + }, []); + + const allBusy = mergeOverlaps([...parseCal(cal1), ...parseCal(cal2)]); + const freePeriods = [ + {start: searchStart, end: allBusy[0]?.start || searchEnd}, + ...allBusy.flatMap((b,i) => + i < allBusy.length - 1 && b.end < allBusy[i+1].start + ? [{start: b.end, end: allBusy[i+1].start}] + : [] + ), + ...(allBusy.at(-1)?.end && allBusy.at(-1).end < searchEnd + ? [{start: allBusy.at(-1).end, end: searchEnd}] + : []) + ].filter(p => p.start < p.end); + + const slots = []; + for (const period of freePeriods) { + const int = Interval.fromDateTimes(period.start, period.end); + let curr = int.start; + + while (curr.plus(duration) <= int.end) { + const slotStart = curr; + const slotEnd = curr.plus(duration); + + const dayStart = slotStart.set({hour: workStart.hour, minute: workStart.minute, second: 0, millisecond: 0}); + const dayEnd = slotStart.set({hour: workEnd.hour, minute: workEnd.minute, second: 0, millisecond: 0}); + + if (Interval.fromDateTimes(slotStart, slotEnd).containedBy( + Interval.fromDateTimes( + Math.max(slotStart, dayStart), + Math.min(slotEnd, dayEnd) + ) + )) { + slots.push({ + start: slotStart.toISO(), + end: slotEnd.toISO() + }); + } + + curr = slotEnd; + } + } + + return slots; +} +export default findAvailableSlots; \ No newline at end of file diff --git a/tests/8_json_validator/outputs/openrouter_sherlock-dash-alpha.js b/tests/8_json_validator/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..c9a005d --- /dev/null +++ b/tests/8_json_validator/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,13 @@ +async function validateJSON(data, schema) { + const { default: Ajv } = await import('https://cdn.skypack.dev/ajv@8'); + const ajv = new Ajv({ allErrors: true, verbose: true }); + const validate = ajv.compile(schema); + const valid = validate(data); + return { + valid, + errors: valid ? [] : ajv.errors?.map(e => + `${e.instancePath || 'data'}: ${e.message} (${e.params?.type || e.schema})` + ) || [] + }; +} +export default validateJSON; \ No newline at end of file diff --git a/tests/9_stream_visualizer/outputs/openrouter_sherlock-dash-alpha.js b/tests/9_stream_visualizer/outputs/openrouter_sherlock-dash-alpha.js new file mode 100644 index 0000000..4966fd1 --- /dev/null +++ b/tests/9_stream_visualizer/outputs/openrouter_sherlock-dash-alpha.js @@ -0,0 +1,26 @@ +async function createStreamVisualizer(asyncIterable, { maxPoints = 100, alpha = 0.3, width = 800, height = 400, yDomain = [-1, 1] } = {}) { + const { select, scaleLinear, scaleTime, line } = await import('https://cdn.skypack.dev/d3@7'); + + let data = [], prevEma; + + for await (const { timestamp, value } of asyncIterable) { + const ema = prevEma === undefined ? value : alpha * value + (1 - alpha) * prevEma; + prevEma = ema; + + data.push({ timestamp, value, ema }); + if (data.length > maxPoints) data.shift(); + } + + if (!data.length) return { data: [], path: '' }; + + const x = scaleLinear().domain([data[0].timestamp, data[data.length - 1].timestamp]).range([0, width]); + const y = scaleLinear().domain(yDomain).range([height, 0]); + + const lineGen = line() + .x(d => x(d.timestamp)) + .y(d => y(d.ema)) + .curve(select.curveMonotoneX); + + return { data, path: lineGen(data) }; +} +export default createStreamVisualizer; \ No newline at end of file