Docs: Update benchmark results

This commit is contained in:
github-actions[bot]
2025-11-27 19:36:55 +00:00
parent e8b9dd6d0e
commit ba567f4017
109 changed files with 1138 additions and 1679 deletions

View File

@@ -1,19 +1,19 @@
async function findConvexHull(points) {
const { uniqWith, isEqual, sortBy } = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.js')
const pts = sortBy(uniqWith(points, isEqual), ['x', 'y'])
if (pts.length < 3) return pts
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x)
const scan = (src, acc = []) => {
src.forEach(p => {
while (acc.length > 1 && cross(acc.at(-2), acc.at(-1), p) <= 0) acc.pop()
acc.push(p)
})
return acc
export async function findConvexHull(pts){
const {default:_}=await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/lodash.js');
const p=_.orderBy(_.uniqWith(pts,(a,b)=>a.x===b.x&&a.y===b.y),['x','y']);
if(p.length<3)return p;
const c=(o,a,b)=>(a.x-o.x)*(b.y-o.y)-(a.y-o.y)*(b.x-o.x);
const l=[],u=[];
for(const v of p){
while(l.length>1&&c(l[l.length-2],l[l.length-1],v)<=0)l.pop();
l.push(v);
}
const lower = scan(pts)
const upper = scan([...pts].reverse())
lower.pop()
upper.pop()
return lower.concat(upper)
for(const v of [...p].reverse()){
while(u.length>1&&c(u[u.length-2],u[u.length-1],v)<=0)u.pop();
u.push(v);
}
return l.slice(0,-1).concat(u.slice(0,-1));
}
export default findConvexHull;
export default findConvexHull;
// Generation time: 10.565s
// Result: PASS