mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-13 16:17:54 +00:00
Docs: Update benchmark for z-ai/glm-4.7
This commit is contained in:
27
tests/2_convex_hull/outputs/z-ai_glm-4.7.js
Normal file
27
tests/2_convex_hull/outputs/z-ai_glm-4.7.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const findConvexHull = async (pts) => {
|
||||
const { sortBy, uniqWith, isEqual } = await import('https://cdn.skypack.dev/lodash');
|
||||
const s = sortBy(uniqWith(pts, isEqual), ['x', 'y']);
|
||||
if (s.length < 2) return s;
|
||||
|
||||
const cp = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
||||
const l = [];
|
||||
const u = [];
|
||||
|
||||
for (const p of s) {
|
||||
while (l.length >= 2 && cp(l[l.length - 2], l[l.length - 1], p) <= 0) l.pop();
|
||||
l.push(p);
|
||||
}
|
||||
|
||||
for (let i = s.length - 1; i >= 0; i--) {
|
||||
const p = s[i];
|
||||
while (u.length >= 2 && cp(u[u.length - 2], u[u.length - 1], p) <= 0) u.pop();
|
||||
u.push(p);
|
||||
}
|
||||
|
||||
u.pop();
|
||||
l.pop();
|
||||
return l.concat(u);
|
||||
};
|
||||
export default findConvexHull;
|
||||
// Generation time: 55.287s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user