|
|
|
|
@ -176,7 +176,7 @@
|
|
|
|
|
sequentialSearch: 0
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
for (let j = 0; j < 5; j++) {
|
|
|
|
|
for (let j = 0; j < 2; j++) {
|
|
|
|
|
|
|
|
|
|
const response = await fetch('/recreate', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
@ -186,7 +186,8 @@
|
|
|
|
|
pointCount: datasetSize,
|
|
|
|
|
capacity: mTreeNodeSize,
|
|
|
|
|
distanceFunction: 'euclidean'
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
timeout: 6000000
|
|
|
|
|
});
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
throw new Error(`error recreating tree: ${await response.text()}`);
|
|
|
|
|
@ -195,9 +196,9 @@
|
|
|
|
|
const { treeCreationTime } = await response.json();
|
|
|
|
|
timingResults.treeCreationTime += treeCreationTime;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 5; i++) {
|
|
|
|
|
for (let i = 0; i < 4; i++) {
|
|
|
|
|
|
|
|
|
|
const queryPoint = Array(dimension).fill(i / 5);
|
|
|
|
|
const queryPoint = Array(dimension).fill(i / 4);
|
|
|
|
|
const knnResponse = await fetch(`/kNNQuery?queryPoint=${encodeURIComponent(JSON.stringify(queryPoint))}&k=${encodeURIComponent((i + 1)*3)}`);
|
|
|
|
|
|
|
|
|
|
if (!knnResponse.ok) {
|
|
|
|
|
@ -229,20 +230,19 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timingResults.treeCreationTime /= 5;
|
|
|
|
|
timingResults.rangeQueryTime.mtreeRangeQuery /= 25;
|
|
|
|
|
functionCallCounts.rangeQuery.mtreeRangeQuery /= 25;
|
|
|
|
|
timingResults.rangeQueryTime.sequentialSearch /= 25;
|
|
|
|
|
functionCallCounts.rangeQuery.sequentialSearch /= 25;
|
|
|
|
|
timingResults.knnQueryTime.mtreeKNNQuery /= 25;
|
|
|
|
|
functionCallCounts.knnQuery.mtreeKNNQuery /= 25;
|
|
|
|
|
timingResults.knnQueryTime.sequentialSearch /= 25;
|
|
|
|
|
functionCallCounts.knnQuery.sequentialSearch /= 25;
|
|
|
|
|
|
|
|
|
|
return { timingResults, functionCallCounts };
|
|
|
|
|
timingResults.treeCreationTime /= 2;
|
|
|
|
|
timingResults.rangeQueryTime.mtreeRangeQuery /= 8;
|
|
|
|
|
functionCallCounts.rangeQuery.mtreeRangeQuery /= 8;
|
|
|
|
|
timingResults.rangeQueryTime.sequentialSearch /= 8;
|
|
|
|
|
functionCallCounts.rangeQuery.sequentialSearch /= 8;
|
|
|
|
|
timingResults.knnQueryTime.mtreeKNNQuery /= 8;
|
|
|
|
|
functionCallCounts.knnQuery.mtreeKNNQuery /= 8;
|
|
|
|
|
timingResults.knnQueryTime.sequentialSearch /= 8;
|
|
|
|
|
functionCallCounts.knnQuery.sequentialSearch /= 8;
|
|
|
|
|
|
|
|
|
|
const endTime = performance.now();
|
|
|
|
|
console.log(`finished at ${endTime} after ${endTime - startTime}ms`);
|
|
|
|
|
return { timingResults, functionCallCounts };
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('error running tests:', error);
|
|
|
|
|
return {};
|
|
|
|
|
|