mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark results
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
23
tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.5.js
Normal file
23
tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.5.js
Normal file
@@ -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;
|
||||
2
tests/1_dijkstra/outputs/google_gemini-2.5-pro.js
Normal file
2
tests/1_dijkstra/outputs/google_gemini-2.5-pro.js
Normal file
@@ -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;
|
||||
2
tests/1_dijkstra/outputs/openai_gpt-5-codex.js
Normal file
2
tests/1_dijkstra/outputs/openai_gpt-5-codex.js
Normal file
@@ -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;
|
||||
Reference in New Issue
Block a user