mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
Docs: Update benchmark results
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
async function findLISLength(a) {
|
||||
if (!a?.length) return 0;
|
||||
async function findLISLength(nums) {
|
||||
if (!nums?.length) return 0;
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
const t = [];
|
||||
for (const n of a) {
|
||||
const i = bisectLeft(t, n);
|
||||
i < t.length ? t[i] = n : t.push(n);
|
||||
const tails = [];
|
||||
for (const n of nums) {
|
||||
const i = bisectLeft(tails, n);
|
||||
i < tails.length ? tails[i] = n : tails.push(n);
|
||||
}
|
||||
return t.length;
|
||||
return tails.length;
|
||||
}
|
||||
export default findLISLength;
|
||||
export default findLISLength;
|
||||
// Generation time: 3.101s
|
||||
// Result: PASS
|
||||
@@ -1,4 +1,4 @@
|
||||
const findLISLength = async (arr) => {
|
||||
async function findLISLength(arr) {
|
||||
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array');
|
||||
|
||||
if (!arr?.length) return 0;
|
||||
@@ -11,5 +11,7 @@ const findLISLength = async (arr) => {
|
||||
}
|
||||
|
||||
return tails.length;
|
||||
};
|
||||
export default findLISLength;
|
||||
}
|
||||
export default findLISLength;
|
||||
// Generation time: 2.177s
|
||||
// Result: PASS
|
||||
@@ -1,16 +0,0 @@
|
||||
const findLISLength = async (nums) => {
|
||||
if (!nums?.length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array/+esm');
|
||||
|
||||
const tails = [];
|
||||
|
||||
nums.forEach((num) => {
|
||||
tails[bisectLeft(tails, num)] = num;
|
||||
});
|
||||
|
||||
return tails.length;
|
||||
};
|
||||
export default findLISLength;
|
||||
@@ -1,9 +1,13 @@
|
||||
const findLISLength = async (nums) => {
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
const tails = [];
|
||||
const findLISLength = async nums => {
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array/+esm')
|
||||
const tails = []
|
||||
|
||||
for (const n of nums) {
|
||||
tails[bisectLeft(tails, n)] = n;
|
||||
tails[bisectLeft(tails, n)] = n
|
||||
}
|
||||
return tails.length;
|
||||
};
|
||||
export default findLISLength;
|
||||
|
||||
return tails.length
|
||||
}
|
||||
export default findLISLength;
|
||||
// Generation time: 25.399s
|
||||
// Result: PASS
|
||||
@@ -1,14 +1,10 @@
|
||||
export async function findLISLength(nums) {
|
||||
if (!Array.isArray(nums) || nums.length === 0) return 0;
|
||||
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
const tails = [];
|
||||
|
||||
for (const num of nums) {
|
||||
const idx = bisectLeft(tails, num);
|
||||
idx === tails.length ? tails.push(num) : tails[idx] = num;
|
||||
}
|
||||
|
||||
return tails.length;
|
||||
export async function findLISLength(a){
|
||||
const{bisectLeft}=await import('https://esm.sh/d3-array');
|
||||
if(!Array.isArray(a))return 0;
|
||||
const t=[];
|
||||
for(const v of a){const i=bisectLeft(t,v);i===t.length?t.push(v):t[i]=v;}
|
||||
return t.length;
|
||||
}
|
||||
export default findLISLength;
|
||||
export default findLISLength;
|
||||
// Generation time: 39.477s
|
||||
// Result: PASS
|
||||
@@ -1,10 +1,12 @@
|
||||
async function findLISLength(a) {
|
||||
const {bisectLeft} = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm')
|
||||
const t=[]
|
||||
for (const x of a||[]) {
|
||||
const i = bisectLeft(t,x)
|
||||
t[i]=x
|
||||
}
|
||||
return t.length
|
||||
async function findLISLength(a){
|
||||
const{bisectLeft}=await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm')
|
||||
const t=[]
|
||||
for(const x of a){
|
||||
const i=bisectLeft(t,x)
|
||||
t[i]=x
|
||||
}
|
||||
return t.length
|
||||
}
|
||||
export default findLISLength;
|
||||
export default findLISLength;
|
||||
// Generation time: 6.704s
|
||||
// Result: PASS
|
||||
@@ -1,14 +0,0 @@
|
||||
const findLISLength = async (nums) => {
|
||||
if (!nums.length) return 0
|
||||
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm')
|
||||
const tails = []
|
||||
|
||||
for (const num of nums) {
|
||||
const i = bisectLeft(tails, num)
|
||||
tails[i] = num
|
||||
}
|
||||
|
||||
return tails.length
|
||||
}
|
||||
export default findLISLength;
|
||||
@@ -1,2 +0,0 @@
|
||||
async function findLISLength(a){const{bisectLeft}=await import('https://cdn.skypack.dev/d3-array');let t=[];for(let n of a){let i=bisectLeft(t,n);i===t.length?t.push(n):t[i]=n}return t.length}
|
||||
export default findLISLength;
|
||||
@@ -1,11 +0,0 @@
|
||||
async function findLISLength(arr) {
|
||||
const {bisectLeft} = await import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm');
|
||||
let tails = [];
|
||||
for (let num of arr) {
|
||||
let i = bisectLeft(tails, num);
|
||||
if (i === tails.length) tails.push(num);
|
||||
else tails[i] = num;
|
||||
}
|
||||
return tails.length;
|
||||
}
|
||||
export default findLISLength;
|
||||
16
tests/3_lis/outputs/x-ai_grok-4.js
Normal file
16
tests/3_lis/outputs/x-ai_grok-4.js
Normal file
@@ -0,0 +1,16 @@
|
||||
async function findLISLength(arr) {
|
||||
const { bisectLeft } = await import('https://cdn.jsdelivr.net/npm/d3-array@3');
|
||||
let tails = [];
|
||||
for (let num of arr) {
|
||||
let pos = bisectLeft(tails, num);
|
||||
if (pos === tails.length) {
|
||||
tails.push(num);
|
||||
} else {
|
||||
tails[pos] = num;
|
||||
}
|
||||
}
|
||||
return tails.length;
|
||||
}
|
||||
export default findLISLength;
|
||||
// Generation time: 47.415s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user