Less GC, no re-declare array across iterations
This commit is contained in:
@@ -19,13 +19,14 @@ import {placeNearToNearestNeighbour} from "./interpCommon";
|
|||||||
* placement of each interpolated point
|
* placement of each interpolated point
|
||||||
*/
|
*/
|
||||||
export default function(sampleSet, remainderSet, distanceFn, endingIts) {
|
export default function(sampleSet, remainderSet, distanceFn, endingIts) {
|
||||||
let sampleSubset = takeSampleFrom(sampleSet, Math.sqrt(sampleSet.length)).sample;
|
let
|
||||||
|
sampleSubset = takeSampleFrom(sampleSet, Math.sqrt(sampleSet.length)).sample,
|
||||||
|
sampleSubsetDistanceCache = [];
|
||||||
|
|
||||||
// For each datapoint "node" to be interpolated
|
// For each datapoint "node" to be interpolated
|
||||||
for (let i = remainderSet.length-1; i>=0; i--) {
|
for (let i = remainderSet.length-1; i>=0; i--) {
|
||||||
let
|
let
|
||||||
node = remainderSet[i],
|
node = remainderSet[i],,
|
||||||
sampleSubsetDistanceCache = [],
|
|
||||||
nearestSample, minDist, sample, dist, index;
|
nearestSample, minDist, sample, dist, index;
|
||||||
|
|
||||||
// For each datapoint "sample" in the sample set
|
// For each datapoint "sample" in the sample set
|
||||||
|
|||||||
Reference in New Issue
Block a user