Skip to content

Commit 9c70ee9

Browse files
committedMay 9, 2017
do not slice array just to read its values in sort loop
1 parent 2dd1333 commit 9c70ee9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed
 

‎src/transforms/sort.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,17 @@ exports.calcTransform = function(gd, trace, opts) {
7878

7979
var target = opts.target;
8080
var len = targetArray.length;
81-
8281
var arrayAttrs = PlotSchema.findArrayAttributes(trace);
8382
var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray);
8483
var indices = getIndices(opts, targetArray, d2c);
8584

8685
for(var i = 0; i < arrayAttrs.length; i++) {
8786
var np = Lib.nestedProperty(trace, arrayAttrs[i]);
88-
var arrayCopy = np.get().slice();
87+
var arrayOld = np.get();
8988
var arrayNew = new Array(len);
9089

9190
for(var j = 0; j < len; j++) {
92-
arrayNew[j] = arrayCopy[indices[j]];
91+
arrayNew[j] = arrayOld[indices[j]];
9392
}
9493

9594
np.set(arrayNew);

0 commit comments

Comments
 (0)