mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-04-27 19:52:14 +00:00
Docs: Update benchmark for z-ai/glm-5.1
This commit is contained in:
25
tests/2_convex_hull/outputs/z-ai_glm-5.1.js
Normal file
25
tests/2_convex_hull/outputs/z-ai_glm-5.1.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const findConvexHull = async (pts) => {
|
||||
const _ = await import("https://esm.run/lodash");
|
||||
const p = _.uniqBy(_.sortBy(pts, ["x", "y"]), p => p.x + "," + p.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 h = [];
|
||||
|
||||
for (const pt of p) {
|
||||
while (h.length >= 2 && c(h.at(-2), h.at(-1), pt) <= 0) h.pop();
|
||||
h.push(pt);
|
||||
}
|
||||
|
||||
const l = h.length + 1;
|
||||
for (let i = p.length - 2; i >= 0; i--) {
|
||||
while (h.length >= l && c(h.at(-2), h.at(-1), p[i]) <= 0) h.pop();
|
||||
h.push(p[i]);
|
||||
}
|
||||
|
||||
h.pop();
|
||||
return h;
|
||||
};
|
||||
export default findConvexHull;
|
||||
// Generation time: 35.612s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user