mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-13 16:17:54 +00:00
Docs: Update benchmark for openai/gpt-5.1-codex-max
This commit is contained in:
9
tests/10_scrypt_hash/outputs/openai_gpt-5.1-codex-max.js
Normal file
9
tests/10_scrypt_hash/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const enc=new TextEncoder()
|
||||
async function hashPassword(p,s){
|
||||
const{default:scrypt}=await import('https://cdn.jsdelivr.net/npm/scrypt-js@3.0.1/+esm')
|
||||
const u=await scrypt(enc.encode(p),enc.encode(s),1024,8,1,32)
|
||||
return[...u].map(x=>x.toString(16).padStart(2,'0')).join('')
|
||||
}
|
||||
export default hashPassword;
|
||||
// Generation time: 12.207s
|
||||
// Result: FAIL
|
||||
10
tests/11_geospatial/outputs/openai_gpt-5.1-codex-max.js
Normal file
10
tests/11_geospatial/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,10 @@
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
const { point, booleanPointInPolygon, lineString, length } = await import('https://cdn.skypack.dev/@turf/turf')
|
||||
const v = readings.filter(r => booleanPointInPolygon(point(r.loc), boundary, { ignoreBoundary: true })).sort((a, b) => a.ts - b.ts)
|
||||
if (v.length < 2) return 0
|
||||
const l = lineString(v.map(r => r.loc))
|
||||
return +length(l, { units: 'kilometers' }).toFixed(2)
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 10.671s
|
||||
// Result: PASS
|
||||
22
tests/1_dijkstra/outputs/openai_gpt-5.1-codex-max.js
Normal file
22
tests/1_dijkstra/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,22 @@
|
||||
async function findShortestPath(g,s,t){
|
||||
let {default:P}=await import('https://cdn.skypack.dev/js-priority-queue')
|
||||
if(!(s in g)||!(t in g))return Infinity
|
||||
let d={},u=new Set,q=new P({comparator:(a,b)=>a[0]-b[0]})
|
||||
Object.keys(g).forEach(k=>d[k]=Infinity)
|
||||
d[s]=0
|
||||
q.queue([0,s])
|
||||
while(q.length){
|
||||
let [w,n]=q.dequeue()
|
||||
if(u.has(n))continue
|
||||
if(n===t)return w
|
||||
u.add(n)
|
||||
for(let m in g[n]){
|
||||
let nw=w+g[n][m]
|
||||
if(nw<d[m])d[m]=nw,q.queue([nw,m])
|
||||
}
|
||||
}
|
||||
return Infinity
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 15.370s
|
||||
// Result: PASS
|
||||
22
tests/2_convex_hull/outputs/openai_gpt-5.1-codex-max.js
Normal file
22
tests/2_convex_hull/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,22 @@
|
||||
async function findConvexHull(a) {
|
||||
const { sortBy, uniqWith, isEqual } = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.js');
|
||||
a = uniqWith(a, isEqual);
|
||||
if (a.length < 4) return a;
|
||||
const b = sortBy(a, [v => v.x, v => v.y]);
|
||||
const c = (o, p, q) => (p.x - o.x) * (q.y - o.y) - (p.y - o.y) * (q.x - o.x);
|
||||
const d = [];
|
||||
for (const p of b) {
|
||||
while (d.length > 1 && c(d[d.length - 2], d[d.length - 1], p) <= 0) d.pop();
|
||||
d.push(p);
|
||||
}
|
||||
const e = [];
|
||||
for (let i = b.length; i--;) {
|
||||
const p = b[i];
|
||||
while (e.length > 1 && c(e[e.length - 2], e[e.length - 1], p) <= 0) e.pop();
|
||||
e.push(p);
|
||||
}
|
||||
return uniqWith([...d, ...e], isEqual);
|
||||
}
|
||||
export default findConvexHull;
|
||||
// Generation time: 16.314s
|
||||
// Result: PASS
|
||||
12
tests/3_lis/outputs/openai_gpt-5.1-codex-max.js
Normal file
12
tests/3_lis/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,12 @@
|
||||
async function findLISLength(a){
|
||||
let {bisectLeft}=await import('https://cdn.jsdelivr.net/npm/d3-array@3')
|
||||
let t=[]
|
||||
for(let x of a){
|
||||
let i=bisectLeft(t,x)
|
||||
t[i]=x
|
||||
}
|
||||
return t.length
|
||||
}
|
||||
export default findLISLength;
|
||||
// Generation time: 8.286s
|
||||
// Result: FAIL
|
||||
7
tests/4_transpiler/outputs/openai_gpt-5.1-codex-max.js
Normal file
7
tests/4_transpiler/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export const renderTemplate=async(template,data)=>{
|
||||
const {default:Handlebars}=await import('https://cdn.jsdelivr.net/npm/handlebars@latest/+esm')
|
||||
return Handlebars.compile(template)(data)
|
||||
}
|
||||
export default renderTemplate;
|
||||
// Generation time: 4.362s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,8 @@
|
||||
let md
|
||||
const parseMarkdown = async s => {
|
||||
md ||= (await import('https://cdn.jsdelivr.net/npm/marked/lib/marked.esm.js')).marked
|
||||
return md.parse(s)
|
||||
}
|
||||
export default parseMarkdown;
|
||||
// Generation time: 8.679s
|
||||
// Result: PASS
|
||||
26
tests/6_csv_processor/outputs/openai_gpt-5.1-codex-max.js
Normal file
26
tests/6_csv_processor/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,26 @@
|
||||
async function processCSV(csv, o) {
|
||||
const { csvParse } = await import('https://cdn.skypack.dev/d3-dsv');
|
||||
const { filterColumn, filterValue, groupBy, aggregateColumn, operation } = o;
|
||||
const rows = csvParse(csv);
|
||||
const m = new Map();
|
||||
for (const r of rows) {
|
||||
if (r[filterColumn] == filterValue) {
|
||||
const g = r[groupBy];
|
||||
let a = +r[aggregateColumn];
|
||||
if (isNaN(a)) a = 0;
|
||||
const v = m.get(g) || { c: 0, s: 0 };
|
||||
v.c++;
|
||||
v.s += a;
|
||||
m.set(g, v);
|
||||
}
|
||||
}
|
||||
const out = [];
|
||||
for (const [k, v] of m) {
|
||||
const result = operation === 'sum' ? v.s : operation === 'count' ? v.c : v.s / v.c;
|
||||
out.push({ [groupBy]: k, result });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
export default processCSV;
|
||||
// Generation time: 11.354s
|
||||
// Result: PASS
|
||||
38
tests/7_scheduler/outputs/openai_gpt-5.1-codex-max.js
Normal file
38
tests/7_scheduler/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,38 @@
|
||||
async function findAvailableSlots(a,b,o){
|
||||
const {default:d}=await import('https://cdn.jsdelivr.net/npm/dayjs@1.11.10/esm/index.js')
|
||||
const {default:u}=await import('https://cdn.jsdelivr.net/npm/dayjs@1.11.10/esm/plugin/utc.js')
|
||||
d.extend(u)
|
||||
const s=d.utc(o.searchRange.start),e=d.utc(o.searchRange.end)
|
||||
const S=s.valueOf(),E=e.valueOf(),t=o.durationMinutes*6e4
|
||||
const busy=[...a,...b].map(v=>[d.utc(v.start).valueOf(),d.utc(v.end).valueOf()]).filter(v=>v[1]>S&&v[0]<E).sort((i,j)=>i[0]-j[0])
|
||||
const m=[]
|
||||
for(const [b0,b1]of busy){
|
||||
const x=Math.max(b0,S),y=Math.min(b1,E)
|
||||
if(!m.length||x>m[m.length-1][1])m.push([x,y])
|
||||
else m[m.length-1][1]=Math.max(m[m.length-1][1],y)
|
||||
}
|
||||
const r=[],ws=o.workHours.start,we=o.workHours.end
|
||||
let j=0
|
||||
for(let day=s.startOf('day');day.isBefore(e);day=day.add(1,'day')){
|
||||
let w0=d.utc(`${day.format('YYYY-MM-DD')}T${ws}Z`).valueOf(),w1=d.utc(`${day.format('YYYY-MM-DD')}T${we}Z`).valueOf()
|
||||
if(w1<=S||w0>=E)continue
|
||||
if(w0<S)w0=S
|
||||
if(w1>E)w1=E
|
||||
if(w0>=w1)continue
|
||||
while(j<m.length&&m[j][1]<=w0)j++
|
||||
let p=w0
|
||||
for(let k=j;k<m.length&&m[k][0]<w1;k++){
|
||||
if(m[k][0]>p){
|
||||
for(let a=p;a+t<=Math.min(m[k][0],w1);a+=t)r.push({start:new Date(a).toISOString(),end:new Date(a+t).toISOString()})
|
||||
}
|
||||
p=Math.max(p,m[k][1])
|
||||
}
|
||||
if(p<w1){
|
||||
for(let a=p;a+t<=w1;a+=t)r.push({start:new Date(a).toISOString(),end:new Date(a+t).toISOString()})
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
export default findAvailableSlots;
|
||||
// Generation time: 62.189s
|
||||
// Result: FAIL
|
||||
10
tests/8_json_validator/outputs/openai_gpt-5.1-codex-max.js
Normal file
10
tests/8_json_validator/outputs/openai_gpt-5.1-codex-max.js
Normal file
@@ -0,0 +1,10 @@
|
||||
async function validateJSON(d,s){
|
||||
const{default:A}=await import('https://cdn.skypack.dev/ajv@8.12.0')
|
||||
const a=new A
|
||||
const v=a.compile(s)
|
||||
const ok=v(d)
|
||||
return ok?{valid:!0,errors:[]}:{valid:!1,errors:v.errors.map(e=>(e.instancePath||'root')+' '+e.message)}
|
||||
}
|
||||
export default validateJSON;
|
||||
// Generation time: 4.189s
|
||||
// Result: PASS
|
||||
@@ -0,0 +1,20 @@
|
||||
async function createStreamVisualizer(it,o={}){
|
||||
let{maxPoints=100,alpha=.3,width=300,height=150,yDomain:[y0,y1]=[0,1]}=o
|
||||
let{scaleLinear,line}=await import('https://cdn.jsdelivr.net/npm/d3@7/+esm')
|
||||
let d=[],e
|
||||
for await(let{timestamp:t,value:v}of it){
|
||||
e=e==null?v:alpha*v+(1-alpha)*e
|
||||
d.push({timestamp:+t,value:v,ema:e})
|
||||
d.length>maxPoints&&d.shift()
|
||||
}
|
||||
let p=''
|
||||
if(d.length){
|
||||
let x=scaleLinear().domain([d[0].timestamp,d.at(-1).timestamp]).range([0,width])
|
||||
let y=scaleLinear().domain([y0,y1]).range([height,0])
|
||||
p=line().x(a=>x(a.timestamp)).y(a=>y(a.ema))(d)||''
|
||||
}
|
||||
return{data:d,path:p}
|
||||
}
|
||||
export default createStreamVisualizer;
|
||||
// Generation time: 25.168s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user