8000 Cleanup benchmarks in perf.js. · lodash/lodash@7adf5e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7adf5e7

Browse files
committed
Cleanup benchmarks in perf.js.
Former-commit-id: f845855383e01c63d513cea53cec86abb4f4fb65
1 parent 0e4afef commit 7adf5e7

File tree

3 files changed

+5
-71
lines changed

3 files changed

+5
-71
lines changed

perf/perf.js

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -308,24 +308,6 @@
308308
}\
309309
}\
310310
}\
311-
if (typeof omit != "undefined") {\
312-
\
313-
var tenWordObject = {\
314-
"one": 1,\
315-
"two": 2,\
316-
"three": 3,\
317-
"four": 4,\
318-
"five": 5,\
319-
"six": 6,\
320-
"seven": 7,\
321-
"eight": 8,\
322-
"nine": 9,\
323-
"ten": 10\
324-
};\
325-
\
326-
var _omitted = _.omit(wordToNumber, tenWordObject),\
327-
lodashOmitted = lodash.omit(wordToNumber, tenWordObject);\
328-
}\
329311
\
330312
if (typeof template != "undefined") {\
331313
var tplData = {\
@@ -1120,18 +1102,6 @@
11201102
})
11211103
);
11221104

1123-
suites.push(
1124-
Benchmark.Suite('`_.omit` iterating 10 properties, omitting 20 keys')
1125-
.add('Lo-Dash', {
1126-
'fn': 'lodash.omit(tenWordObject, words)',
1127-
'teardown': 'function omit(){}'
1128-
})
1129-
.add('Underscore', {
1130-
'fn': '_.omit(tenWordObject, words)',
1131-
'teardown': 'function omit(){}'
1132-
})
1133-
);
1134-
11351105
/*--------------------------------------------------------------------------*/
11361106

11371107
suites.push(
@@ -1378,42 +1348,6 @@
13781348
)
13791349
);
13801350

1381-
suites.push(
1382-
Benchmark.Suite('`_.union` iterating an array of 25 elements')
1383-
.add('Lo-Dash', {
1384-
'fn': 'lodash.union(twentyFiveValues, twentyFiveValues2)',
1385-
'teardown': 'function multiArrays(){}'
1386-
})
1387-
.add('Underscore', {
1388-
'fn': '_.union(twentyFiveValues, twentyFiveValues2)',
1389-
'teardown': 'function multiArrays(){}'
1390-
})
1391-
);
1392-
1393-
suites.push(
1394-
Benchmark.Suite('`_.union` iterating an array of 50 elements')
1395-
.add('Lo-Dash', {
1396-
'fn': 'lodash.union(fiftyValues, fiftyValues2)',
1397-
'teardown': 'function multiArrays(){}'
1398-
})
1399-
.add('Underscore', {
1400-
'fn': '_.union(fiftyValues, fiftyValues2)',
1401-
'teardown': 'function multiArrays(){}'
1402-
})
1403-
);
1404-
1405-
suites.push(
1406-
Benchmark.Suite('`_.union` iterating an array of 75 elements')
1407-
.add('Lo-Dash', {
1408-
'fn': 'lodash.union(seventyFiveValues, seventyFiveValues2)',
1409-
'teardown': 'function multiArrays(){}'
1410-
})
1411-
.add('Underscore', {
1412-
'fn': '_.union(seventyFiveValues, seventyFiveValues2)',
1413-
'teardown': 'function multiArrays(){}'
1414-
})
1415-
);
1416-
14171351
/*--------------------------------------------------------------------------*/
14181352

14191353
suites.push(

vendor/underscore/underscore-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/underscore/underscore.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,11 @@
708708

709709
// Return a copy of the object without the blacklisted properties.
710710
_.omit = function(obj) {
711-
var copy = _.extend({}, obj);
711+
var copy = {};
712712
var keys = _.flatten(slice.call(arguments, 1));
713-
each(keys, function(key) {
714-
delete copy[key];
715-
});
713+
for (var key in obj) {
714+
if (!_.include(keys, key)) copy[key] = obj[key];
715+
}
716716
return copy;
717717
};
718718

0 commit comments

Comments
 (0)
0