Docs: Update benchmark results

This commit is contained in:
github-actions[bot]
2025-11-07 21:32:49 +00:00
parent f9da7d4ed7
commit d0bc3b95dd
54 changed files with 1115 additions and 372 deletions

View File

@@ -2,7 +2,6 @@ const findLISLength = async (arr) => {
if (!arr?.length) return 0;
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array');
const tails = [];
for (const num of arr) {
@@ -12,5 +11,4 @@ const findLISLength = async (arr) => {
return tails.length;
};
export default findLISLength;
export default findLISLength;

View File

@@ -1,8 +1,8 @@
const findLISLength = async (arr) => {
if (!arr?.length) return 0;
async function findLISLength(arr) {
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array');
if (!arr?.length) return 0;
const tails = [];
for (const num of arr) {
@@ -11,5 +11,5 @@ const findLISLength = async (arr) => {
}
return tails.length;
};
}
export default findLISLength;

View File

@@ -1,15 +1,15 @@
const findLISLength = async (nums) => {
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array');
async function findLISLength(nums) {
if (!nums?.length) return 0;
const { bisectLeft } = await import('https://cdn.skypack.dev/d3-array');
const tails = [];
for (const num of nums) {
const idx = bisectLeft(tails, num);
tails[idx] = num;
const pos = bisectLeft(tails, num);
tails[pos] = num;
}
return tails.length;
};
}
export default findLISLength;

View File

@@ -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) {
tails[bisectLeft(tails, num)] = num;
}
return tails.length;
};
export default findLISLength;

View File

@@ -1,13 +1,15 @@
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) {
tails[bisectLeft(tails, num)] = num;
if (!nums?.length) {
return 0;
}
const { bisectLeft } = await import("https://cdn.jsdelivr.net/npm/d3-array@3");
const tails = nums.reduce((sub, num) => {
sub[bisectLeft(sub, num)] = num;
return sub;
}, []);
return tails.length;
};
export default findLISLength;

View File

@@ -1,13 +0,0 @@
const findLISLength = async (nums) => {
if (!Array.isArray(nums) || !nums.length) return 0;
const { bisectLeft } = await import("https://cdn.jsdelivr.net/npm/d3-array");
const tails = [];
for (const num of nums) {
tails[bisectLeft(tails, num)] = num;
}
return tails.length;
};
export default findLISLength;

View File

@@ -1,14 +1,14 @@
const loadBisectLeft=(()=>{let cache;return()=>cache||(cache=import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm').then(({bisectLeft})=>bisectLeft));})();
export async function findLISLength(nums){
if(!Array.isArray(nums)) throw new TypeError('Expected an array');
if(!nums.length) return 0;
const bisectLeft=await loadBisectLeft();
const tails=[];
for(const value of nums){
if(!Number.isFinite(value)) throw new TypeError('Array must contain only finite numbers');
const index=bisectLeft(tails,value,0,tails.length);
tails[index]=value;
}
return tails.length;
const findLISLength=async a=>{
if(!Array.isArray(a)) throw new TypeError('Expected an array')
const {bisectLeft:b}=await (findLISLength.m??=import('https://cdn.jsdelivr.net/npm/d3-array@3/+esm'))
const t=[]
for(const v of a){
if(!Number.isFinite(v)) throw new TypeError('Array values must be finite numbers')
const i=b(t,v)
if(i===t.length) t.push(v)
else t[i]=v
}
return t.length
}
window.findLISLength=findLISLength
export default findLISLength;

View File

@@ -0,0 +1,12 @@
async function findLISLength(a){
if(!a||!a.length)return 0
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)
if(i===t.length)t.push(x)
else t[i]=x
}
return t.length
}
export default findLISLength;