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,15 +1,12 @@
async function analyzeGPS(readings, boundary) {
const turf = await import('https://cdn.jsdelivr.net/npm/@turf/turf@7/+esm');
const turf = await import("https://esm.sh/@turf/turf");
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;
return Math.round(turf.length(line, { units: "kilometers" }) * 100) / 100;
}
export default analyzeGPS;
export default analyzeGPS;
// Generation time: 3.155s
// Result: PASS

View File

@@ -11,4 +11,6 @@ async function analyzeGPS(readings, boundary) {
return Math.round(turf.length(line) * 100) / 100;
}
export default analyzeGPS;
export default analyzeGPS;
// Generation time: 2.827s
// Result: PASS

View File

@@ -1,18 +0,0 @@
const analyzeGPS = async (readings, boundary) => {
const { booleanPointInPolygon, lineString, length } = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm');
const sortedCoords = readings
.filter(({ loc }) => booleanPointInPolygon(loc, boundary, { ignoreBoundary: true }))
.sort((a, b) => a.ts - b.ts)
.map(({ loc }) => loc);
if (sortedCoords.length < 2) {
return 0;
}
const path = lineString(sortedCoords);
const dist = length(path, { units: 'kilometers' });
return Math.round(dist * 1e2) / 1e2;
};
export default analyzeGPS;

View File

@@ -1,12 +1,14 @@
const analyzeGPS = async (readings, boundary) => {
const turf = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm');
const t = await import('https://cdn.jsdelivr.net/npm/@turf/turf/+esm');
const pts = readings
.filter(({ loc }) => turf.booleanPointInPolygon(turf.point(loc), boundary))
.filter(r => t.booleanPointInPolygon(t.point(r.loc), boundary, { ignoreBoundary: true }))
.sort((a, b) => a.ts - b.ts)
.map(r => r.loc);
return pts.length < 2 ? 0 :
+turf.length(turf.lineString(pts), { units: 'kilometers' }).toFixed(2);
return pts.length < 2 ? 0
: +t.length(t.lineString(pts), { units: 'kilometers' }).toFixed(2);
};
export default analyzeGPS;
export default analyzeGPS;
// Generation time: 41.986s
// Result: PASS

View File

@@ -1,11 +1,18 @@
export async function analyzeGPS(readings, boundary) {
const { booleanPointInPolygon, lineString, length } = await import('https://cdn.skypack.dev/@turf/turf');
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 pts = readings
.filter(r => booleanPointInPolygon(r.loc, boundary))
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 pts.length < 2 ? 0 : +length(lineString(pts)).toFixed(2);
return points.length < 2 ? 0 : Math.round(turf.length(turf.lineString(points), {units: 'kilometers'}) * 100) / 100;
}
export default analyzeGPS;
export default analyzeGPS;
// Generation time: 48.580s
// Result: PASS

View File

@@ -1,13 +1,12 @@
let turf$;
const useTurf = () => turf$ ??= import('https://cdn.skypack.dev/@turf/turf?min');
async function analyzeGPS(readings, boundary) {
const t = await useTurf();
const pts = readings
.filter(r => t.booleanPointInPolygon(t.point(r.loc), boundary))
.sort((a, b) => a.ts - b.ts);
if (pts.length < 2) return 0;
const km = t.length(t.lineString(pts.map(r => r.loc)), { units: 'kilometers' });
return Math.round(km * 100) / 100;
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;
export default analyzeGPS;
// Generation time: 8.791s
// Result: PASS

View File

@@ -1,16 +0,0 @@
export const analyzeGPS = async (readings, boundary) => {
const { default: turf } = await import('https://unpkg.com/@turf/turf@6/turf.min.js')
const inside = readings.filter(({ loc }) =>
turf.booleanPointInPolygon(turf.point(loc), boundary, { ignoreBoundary: false })
)
if (inside.length < 2) return 0
const sorted = inside.sort((a, b) => a.ts - b.ts)
const line = turf.lineString(sorted.map(({ loc }) => loc))
const length = turf.length(line, { units: 'kilometers' })
return Math.round(length * 100) / 100
}
export default analyzeGPS;

View File

@@ -1,8 +0,0 @@
async function analyzeGPS(readings,boundary){
const{booleanPointInPolygon,lineString,length}=await import('https://cdn.skypack.dev/@turf/turf');
const valid=readings
.filter(r=>booleanPointInPolygon({type:'Point',coordinates:r.loc},boundary,{ignoreBoundary:true}))
.sort((a,b)=>a.ts-b.ts);
return valid.length<2?0:+length(lineString(valid.map(r=>r.loc)),{units:'kilometers'}).toFixed(2);
}
export default analyzeGPS;

View File

@@ -1,6 +0,0 @@
async function analyzeGPS(readings, boundary) {
const { point: p, booleanPointInPolygon: i, lineString: s, length: l } = await import('https://esm.sh/@turf/turf@6');
const v = readings.filter(r => i(p(r.loc), boundary)).sort((a, b) => a.ts - b.ts);
return v.length < 2 ? 0 : +l(s(v.map(r => r.loc))).toFixed(2);
}
export default analyzeGPS;

View File

@@ -0,0 +1,13 @@
async function analyzeGPS(readings, boundary) {
const turf = await import('https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js');
const valid = readings
.filter(r => turf.booleanPointInPolygon(turf.point(r.loc), boundary))
.sort((a, b) => a.ts - b.ts);
if (valid.length < 2) return 0;
const line = { type: 'LineString', coordinates: valid.map(r => r.loc) };
const length = turf.length(line, { units: 'kilometers' });
return Math.round(length * 100) / 100;
}
export default analyzeGPS;
// Generation time: 17.976s
// Result: FAIL