wip
This commit is contained in:
parent
53d6fcea63
commit
2f02580648
@ -109,6 +109,7 @@ async function table(osrm, numRequests, gpsData) {
|
|||||||
|
|
||||||
times.push(await runOSRMMethod(osrm, 'table', coordinates));
|
times.push(await runOSRMMethod(osrm, 'table', coordinates));
|
||||||
}
|
}
|
||||||
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function match(osrm, numRequests, gpsData) {
|
async function match(osrm, numRequests, gpsData) {
|
||||||
@ -119,8 +120,8 @@ async function match(osrm, numRequests, gpsData) {
|
|||||||
|
|
||||||
|
|
||||||
times.push(await runOSRMMethod(osrm, 'match', coordinates));
|
times.push(await runOSRMMethod(osrm, 'match', coordinates));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function trip(osrm, numRequests, gpsData) {
|
async function trip(osrm, numRequests, gpsData) {
|
||||||
@ -134,8 +135,8 @@ async function trip(osrm, numRequests, gpsData) {
|
|||||||
|
|
||||||
|
|
||||||
times.push(await runOSRMMethod(osrm, 'trip', coordinates));
|
times.push(await runOSRMMethod(osrm, 'trip', coordinates));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bootstrapConfidenceInterval(data, numSamples = 1000, confidenceLevel = 0.95) {
|
function bootstrapConfidenceInterval(data, numSamples = 1000, confidenceLevel = 0.95) {
|
||||||
@ -170,7 +171,6 @@ function calculateConfidenceInterval(data) {
|
|||||||
return { mean, errorMargin, bestValue };
|
return { mean, errorMargin, bestValue };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
|
|
||||||
@ -200,10 +200,9 @@ async function main() {
|
|||||||
const allTimes = [];
|
const allTimes = [];
|
||||||
for (let i = 0; i < iterations; i++) {
|
for (let i = 0; i < iterations; i++) {
|
||||||
RNG = seedrandom(42);
|
RNG = seedrandom(42);
|
||||||
allTimes.push(await func(osrm, numRequests, gpsData));
|
allTimes.push((await func(osrm, numRequests, gpsData)).filter(t => t !== null));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(allTimes.length);
|
|
||||||
const opsPerSec = allTimes.map(times => times.length / times.reduce((a, b) => a + b, 0));
|
const opsPerSec = allTimes.map(times => times.length / times.reduce((a, b) => a + b, 0));
|
||||||
const { mean, errorMargin, bestValue } = calculateConfidenceInterval(opsPerSec);
|
const { mean, errorMargin, bestValue } = calculateConfidenceInterval(opsPerSec);
|
||||||
console.log(`Ops: ${mean} ± ${errorMargin} ops/s. Best: ${bestValue} ops/s`);
|
console.log(`Ops: ${mean} ± ${errorMargin} ops/s. Best: ${bestValue} ops/s`);
|
||||||
|
Loading…
Reference in New Issue
Block a user