From def79ffc8a1e09d451917914f15af3f76d263113 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 13 Oct 2025 17:40:23 +0000 Subject: [PATCH] Docs: Update benchmark results --- results.json | 8 +++---- .../outputs/anthropic_claude-sonnet-4.5.js | 23 +++++++++++++++++++ .../outputs/google_gemini-2.5-pro.js | 2 ++ .../1_dijkstra/outputs/openai_gpt-5-codex.js | 2 ++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.5.js create mode 100644 tests/1_dijkstra/outputs/google_gemini-2.5-pro.js create mode 100644 tests/1_dijkstra/outputs/openai_gpt-5-codex.js diff --git a/results.json b/results.json index 4753740..2de388d 100644 --- a/results.json +++ b/results.json @@ -1,11 +1,11 @@ { "google/gemini-2.5-pro": { - "1_dijkstra": null + "1_dijkstra": 68.831806591 }, "anthropic/claude-sonnet-4.5": { - "1_dijkstra": null + "1_dijkstra": 5.513186071999997 }, "openai/gpt-5-codex": { - "1_dijkstra": null + "1_dijkstra": 126.619165211 } -} +} \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.5.js b/tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.5.js new file mode 100644 index 0000000..9e3b549 --- /dev/null +++ b/tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.5.js @@ -0,0 +1,23 @@ +async function findShortestPath(graph, start, end) { + const { default: PriorityQueue } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm'); + const distances = Object.keys(graph).reduce((acc, node) => ({ ...acc, [node]: Infinity }), {}); + distances[start] = 0; + const pq = new PriorityQueue({ comparator: (a, b) => a[1] - b[1] }); + pq.queue([start, 0]); + const visited = new Set(); + while (pq.length > 0) { + const [current, currentDist] = pq.dequeue(); + if (visited.has(current)) continue; + visited.add(current); + if (current === end) return currentDist; + for (const [neighbor, weight] of Object.entries(graph[current] || {})) { + const newDist = currentDist + weight; + if (newDist < distances[neighbor]) { + distances[neighbor] = newDist; + pq.queue([neighbor, newDist]); + } + } + } + return distances[end]; +} +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/google_gemini-2.5-pro.js b/tests/1_dijkstra/outputs/google_gemini-2.5-pro.js new file mode 100644 index 0000000..cd09a97 --- /dev/null +++ b/tests/1_dijkstra/outputs/google_gemini-2.5-pro.js @@ -0,0 +1,2 @@ +const findShortestPath = async (graph, start, end) => (async () => { const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/priority-queue.min.js'); const dists = Object.fromEntries(Object.keys(graph).map(k => [k, Infinity])), pq = new PQ({ comparator: (a, b) => a[1] - b[1] }); dists[start] = 0; pq.queue([start, 0]); while (pq.length) { const [node] = pq.dequeue(); if (node === end) break; for (const [neighbor, weight] of Object.entries(graph[node] || {})) { const newDist = dists[node] + weight; if (newDist < dists[neighbor]) { dists[neighbor] = newDist; pq.queue([neighbor, newDist]); } } } return dists[end]; })(); +export default findShortestPath; \ No newline at end of file diff --git a/tests/1_dijkstra/outputs/openai_gpt-5-codex.js b/tests/1_dijkstra/outputs/openai_gpt-5-codex.js new file mode 100644 index 0000000..483fa65 --- /dev/null +++ b/tests/1_dijkstra/outputs/openai_gpt-5-codex.js @@ -0,0 +1,2 @@ +async function findShortestPath(graph,start,end){const{default:PriorityQueue}=await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.3.0/dist/priority-queue.esm.js');if(start==null||end==null)return Infinity;if(start===end)return 0;if(!graph||!Object.prototype.hasOwnProperty.call(graph,start))return Infinity;const visited=new Set;const dist=new Map([[start,0]]);const pq=new PriorityQueue({comparator:(a,b)=>a[0]-b[0]});pq.queue([0,start]);for(;pq.length;){const[d,node]=pq.dequeue();if(visited.has(node))continue;visited.add(node);if(node===end)return d;const neighbors=graph[node]||{};for(const[neighbor,weight]of Object.entries(neighbors)){if(typeof weight!=='number'||weight<0)continue;const alt=d+weight;if(alt<(dist.get(neighbor)??Infinity)){dist.set(neighbor,alt);pq.queue([alt,neighbor]);}}}return Infinity;} +export default findShortestPath; \ No newline at end of file