mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 11:21:00 +00:00
Refactor: Remove stale benchmark outputs
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
const turf = await import("https://cdn.jsdelivr.net/npm/@turf/turf@7/+esm");
|
||||
|
||||
const valid = readings
|
||||
.filter(r => turf.booleanPointInPolygon(turf.point(r.loc), boundary, { ignoreBoundary: true }))
|
||||
.sort((a, b) => a.ts - b.ts);
|
||||
|
||||
if (valid.length < 2) return 0;
|
||||
|
||||
const line = turf.lineString(valid.map(r => r.loc));
|
||||
const len = turf.length(line, { units: "kilometers" });
|
||||
|
||||
return Math.round(len * 100) / 100;
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 3.692s
|
||||
// Result: PASS
|
||||
@@ -1,17 +0,0 @@
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
const turf = await import("https://cdn.jsdelivr.net/npm/@turf/turf@7/+esm");
|
||||
|
||||
const valid = readings
|
||||
.filter(r => turf.booleanPointInPolygon(turf.point(r.loc), boundary, { ignoreBoundary: true }))
|
||||
.sort((a, b) => a.ts - b.ts);
|
||||
|
||||
if (valid.length < 2) return 0;
|
||||
|
||||
const line = turf.lineString(valid.map(r => r.loc));
|
||||
const len = turf.length(line, { units: "kilometers" });
|
||||
|
||||
return Math.round(len * 100) / 100;
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 3.774s
|
||||
// Result: PASS
|
||||
@@ -1,17 +0,0 @@
|
||||
export async function analyzeGPS(readings, boundary) {
|
||||
const T = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm');
|
||||
|
||||
const pts = readings
|
||||
.filter(({ loc }) => T.booleanPointInPolygon(loc, boundary))
|
||||
.sort((a, b) => a.ts - b.ts)
|
||||
.map(({ loc }) => loc);
|
||||
|
||||
if (pts.length < 2) return 0;
|
||||
|
||||
const len = T.length(T.lineString(pts), { units: 'kilometers' });
|
||||
|
||||
return Math.round(len * 100) / 100;
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 9.884s
|
||||
// Result: PASS
|
||||
@@ -1,12 +0,0 @@
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
if (!readings?.length) return 0;
|
||||
const turf = await import('https://cdn.skypack.dev/@turf/turf');
|
||||
const valid = readings.filter(r => turf.booleanPointInPolygon(r.loc, boundary));
|
||||
valid.sort((a, b) => a.ts - b.ts);
|
||||
if (valid.length < 2) return 0;
|
||||
const line = turf.lineString(valid.map(r => r.loc));
|
||||
return Math.round(turf.length(line, { units: 'kilometers' }) * 100) / 100;
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 6.167s
|
||||
// Result: PASS
|
||||
@@ -1,11 +0,0 @@
|
||||
export async function analyzeGPS(readings, boundary) {
|
||||
const t = await import('https://cdn.skypack.dev/@turf/turf')
|
||||
const v = readings.filter(r => t.booleanPointInPolygon(r.loc, boundary)).sort((a,b) => a.ts-b.ts)
|
||||
if(v.length < 2) return 0
|
||||
const coords = v.map(r => r.loc)
|
||||
const line = t.lineString(coords)
|
||||
return Math.round(t.length(line, {units:'kilometers'})*100)/100
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 11.219s
|
||||
// Result: PASS
|
||||
@@ -1,18 +0,0 @@
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
const isValid = r => r?.ts != null && Array.isArray(r?.loc) && r.loc.length === 2;
|
||||
const valid = readings?.filter(isValid) || [];
|
||||
if (valid.length < 2) return 0;
|
||||
|
||||
const turf = await import('https://cdn.skypack.dev/@turf/turf').catch(() => null);
|
||||
if (!turf) return 0;
|
||||
|
||||
const points = valid
|
||||
.filter(r => turf.booleanPointInPolygon(r.loc, boundary))
|
||||
.sort((a, b) => a.ts - b.ts)
|
||||
.map(r => r.loc);
|
||||
|
||||
return points.length < 2 ? 0 : Math.round(turf.length(turf.lineString(points), {units: 'kilometers'}) * 100) / 100;
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 48.580s
|
||||
// Result: PASS
|
||||
@@ -1,10 +0,0 @@
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
const { point, booleanPointInPolygon, lineString, length } = await import('https://cdn.skypack.dev/@turf/turf')
|
||||
const v = readings.filter(r => booleanPointInPolygon(point(r.loc), boundary, { ignoreBoundary: true })).sort((a, b) => a.ts - b.ts)
|
||||
if (v.length < 2) return 0
|
||||
const l = lineString(v.map(r => r.loc))
|
||||
return +length(l, { units: 'kilometers' }).toFixed(2)
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 10.671s
|
||||
// Result: PASS
|
||||
@@ -1,12 +0,0 @@
|
||||
let turfReady
|
||||
const loadTurf=()=>turfReady||(turfReady=import('https://cdn.jsdelivr.net/npm/@turf/turf@6.5.0/+esm'))
|
||||
async function analyzeGPS(readings,boundary){
|
||||
const {point,lineString,length,booleanPointInPolygon}=await loadTurf()
|
||||
const inBounds=readings.filter(r=>booleanPointInPolygon(point(r.loc),boundary,{ignoreBoundary:true})).sort((a,b)=>a.ts-b.ts)
|
||||
if(inBounds.length<2)return 0
|
||||
const km=length(lineString(inBounds.map(r=>r.loc)),{units:'kilometers'})
|
||||
return +km.toFixed(2)
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 8.791s
|
||||
// Result: PASS
|
||||
@@ -1,31 +0,0 @@
|
||||
const TURF_SRC = "https://cdn.jsdelivr.net/npm/@turf/turf@6.5.0/+esm"
|
||||
let turfP
|
||||
const turf = () => turfP || (turfP = import(TURF_SRC))
|
||||
|
||||
async function analyzeGPS(readings, boundary) {
|
||||
if (!Array.isArray(readings) || !boundary) return 0
|
||||
|
||||
const {
|
||||
point: pt,
|
||||
booleanPointInPolygon: inPoly,
|
||||
lineString: ls,
|
||||
length: len
|
||||
} = await turf()
|
||||
|
||||
const ok = []
|
||||
for (const r of readings) {
|
||||
const ts = +r?.ts
|
||||
const loc = [+r?.loc?.[0], +r?.loc?.[1]]
|
||||
if (!Number.isFinite(ts) || loc.some(n => !Number.isFinite(n))) continue
|
||||
if (inPoly(pt(loc), boundary, { ignoreBoundary: true })) ok.push({ ts, loc })
|
||||
}
|
||||
|
||||
if (ok.length < 2) return 0
|
||||
ok.sort((a, b) => a.ts - b.ts)
|
||||
|
||||
const km = len(ls(ok.map(r => r.loc)), { units: "kilometers" })
|
||||
return Number.isFinite(km) ? +km.toFixed(2) : 0
|
||||
}
|
||||
export default analyzeGPS;
|
||||
// Generation time: 113.549s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user