Skip to content

Commit a3a9bc5

Browse files
committed
- Code comments on performance problems with spread operator in Babel
1 parent a52dd41 commit a3a9bc5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/jsonpath.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ JSONPath.prototype._trace = function (
262262
const ret = [];
263263
function addRet (elems) {
264264
if (Array.isArray(elems)) {
265+
// This was too slow with Babel against our performance test: ret.push(...elems);
265266
elems.forEach((t) => {
266267
ret.push(t);
267268
});
@@ -440,6 +441,7 @@ JSONPath.prototype._slice = function (loc, expr, val, path, parent, parentPropNa
440441
for (let i = start; i < end; i += step) {
441442
const tmp = this._trace(unshift(i, expr), val, path, parent, parentPropName, callback);
442443
if (Array.isArray(tmp)) {
444+
// This was too slow with Babel against our performance test: ret.push(...tmp);
443445
tmp.forEach((t) => {
444446
ret.push(t);
445447
});

0 commit comments

Comments
 (0)