wip
This commit is contained in:
parent
b6c4b05c2c
commit
88fce93aaf
@ -76,18 +76,18 @@ async function runOSRMMethod(osrm, method, coordinates) {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function nearest(osrm, numRequests, gpsData) {
|
async function nearest(osrm, gpsData) {
|
||||||
const times = [];
|
const times = [];
|
||||||
for (let i = 0; i < numRequests; i++) {
|
for (let i = 0; i < 1000; i++) {
|
||||||
const coord = gpsData.getRandomCoordinate();
|
const coord = gpsData.getRandomCoordinate();
|
||||||
times.push(await runOSRMMethod(osrm, 'nearest', [coord]));
|
times.push(await runOSRMMethod(osrm, 'nearest', [coord]));
|
||||||
}
|
}
|
||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function route(osrm, numRequests, gpsData) {
|
async function route(osrm, gpsData) {
|
||||||
const times = [];
|
const times = [];
|
||||||
for (let i = 0; i < numRequests; i++) {
|
for (let i = 0; i < 1000; i++) {
|
||||||
const from = gpsData.getRandomCoordinate();
|
const from = gpsData.getRandomCoordinate();
|
||||||
const to = gpsData.getRandomCoordinate();
|
const to = gpsData.getRandomCoordinate();
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ async function route(osrm, numRequests, gpsData) {
|
|||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function table(osrm, numRequests, gpsData) {
|
async function table(osrm, gpsData) {
|
||||||
const times = [];
|
const times = [];
|
||||||
for (let i = 0; i < 250; i++) {
|
for (let i = 0; i < 250; i++) {
|
||||||
const numPoints = Math.floor(RNG() * 3) + 15;
|
const numPoints = Math.floor(RNG() * 3) + 15;
|
||||||
@ -112,9 +112,9 @@ async function table(osrm, numRequests, gpsData) {
|
|||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function match(osrm, numRequests, gpsData) {
|
async function match(osrm, gpsData) {
|
||||||
const times = [];
|
const times = [];
|
||||||
for (let i = 0; i < numRequests; i++) {
|
for (let i = 0; i < 1000; i++) {
|
||||||
const numPoints = Math.floor(RNG() * 50) + 50;
|
const numPoints = Math.floor(RNG() * 50) + 50;
|
||||||
const coordinates = gpsData.getRandomTrack().slice(0, numPoints);
|
const coordinates = gpsData.getRandomTrack().slice(0, numPoints);
|
||||||
|
|
||||||
@ -124,9 +124,9 @@ async function match(osrm, numRequests, gpsData) {
|
|||||||
return times;
|
return times;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function trip(osrm, numRequests, gpsData) {
|
async function trip(osrm, gpsData) {
|
||||||
const times = [];
|
const times = [];
|
||||||
for (let i = 0; i < numRequests; i++) {
|
for (let i = 0; i < 250; i++) {
|
||||||
const numPoints = Math.floor(RNG() * 2) + 5;
|
const numPoints = Math.floor(RNG() * 2) + 5;
|
||||||
const coordinates = [];
|
const coordinates = [];
|
||||||
for (let i = 0; i < numPoints; i++) {
|
for (let i = 0; i < numPoints; i++) {
|
||||||
@ -178,9 +178,8 @@ async function main() {
|
|||||||
const path = args[1];
|
const path = args[1];
|
||||||
const algorithm = args[2].toUpperCase();
|
const algorithm = args[2].toUpperCase();
|
||||||
const method = args[3];
|
const method = args[3];
|
||||||
const numRequests = parseInt(args[4]);
|
const gpsTracesFilePath = args[4];
|
||||||
const gpsTracesFilePath = args[5];
|
const iterations = parseInt(args[5]);
|
||||||
const iterations = parseInt(args[6]);
|
|
||||||
|
|
||||||
const gpsData = new GPSData(gpsTracesFilePath);
|
const gpsData = new GPSData(gpsTracesFilePath);
|
||||||
const osrm = new OSRM({path, algorithm});
|
const osrm = new OSRM({path, algorithm});
|
||||||
@ -200,7 +199,7 @@ 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)).filter(t => t !== null));
|
allTimes.push((await func(osrm, gpsData)).filter(t => t !== null));
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
@ -85,9 +85,9 @@ function run_benchmarks_for_folder {
|
|||||||
|
|
||||||
for ALGORITHM in ch mld; do
|
for ALGORITHM in ch mld; do
|
||||||
for BENCH in nearest table trip route match; do
|
for BENCH in nearest table trip route match; do
|
||||||
echo "Running random $BENCH $ALGORITHM"
|
echo "Running node $BENCH $ALGORITHM"
|
||||||
START=$(date +%s.%N)
|
START=$(date +%s.%N)
|
||||||
node $SCRIPTS_FOLDER/scripts/ci/bench.js $FOLDER/lib/binding/node_osrm.node $FOLDER/data.osrm $ALGORITHM $BENCH 1000 $GPS_TRACES > "$RESULTS_FOLDER/node_${BENCH}_${ALGORITHM}.bench" 5 #|| true
|
node $SCRIPTS_FOLDER/scripts/ci/bench.js $FOLDER/lib/binding/node_osrm.node $FOLDER/data.osrm $ALGORITHM $BENCH $GPS_TRACES > "$RESULTS_FOLDER/node_${BENCH}_${ALGORITHM}.bench" 5
|
||||||
END=$(date +%s.%N)
|
END=$(date +%s.%N)
|
||||||
DIFF=$(echo "$END - $START" | bc)
|
DIFF=$(echo "$END - $START" | bc)
|
||||||
echo "Took: ${DIFF}s"
|
echo "Took: ${DIFF}s"
|
||||||
|
Loading…
Reference in New Issue
Block a user