mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Add _.sample benchmark.
This commit is contained in:
36
perf/perf.js
36
perf/perf.js
@@ -719,20 +719,20 @@
|
|||||||
suites.push(
|
suites.push(
|
||||||
Benchmark.Suite('`_.contains` iterating an array')
|
Benchmark.Suite('`_.contains` iterating an array')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
lodash.contains(numbers, 19)'
|
lodash.contains(numbers, limit - 1)'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
_.contains(numbers, 19)'
|
_.contains(numbers, limit - 1)'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
suites.push(
|
suites.push(
|
||||||
Benchmark.Suite('`_.contains` iterating an object')
|
Benchmark.Suite('`_.contains` iterating an object')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
lodash.contains(object, 19)'
|
lodash.contains(object, limit - 1)'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
_.contains(object, 19)'
|
_.contains(object, limit - 1)'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -974,12 +974,12 @@
|
|||||||
Benchmark.Suite('`_.find` iterating an array')
|
Benchmark.Suite('`_.find` iterating an array')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
lodash.find(numbers, function(num) {\
|
lodash.find(numbers, function(num) {\
|
||||||
return num === 19;\
|
return num === (limit - 1);\
|
||||||
})'
|
})'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
_.find(numbers, function(num) {\
|
_.find(numbers, function(num) {\
|
||||||
return num === 19;\
|
return num === (limit - 1);\
|
||||||
})'
|
})'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -1591,6 +1591,18 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
suites.push(
|
||||||
|
Benchmark.Suite('`_.sample` with an `n`')
|
||||||
|
.add(buildName, '\
|
||||||
|
lodash.sample(numbers, limit / 2)'
|
||||||
|
)
|
||||||
|
.add(otherName, '\
|
||||||
|
_.sample(numbers, limit / 2)'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
suites.push(
|
suites.push(
|
||||||
Benchmark.Suite('`_.shuffle`')
|
Benchmark.Suite('`_.shuffle`')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
@@ -1619,12 +1631,12 @@
|
|||||||
Benchmark.Suite('`_.some` iterating an array')
|
Benchmark.Suite('`_.some` iterating an array')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
lodash.some(numbers, function(num) {\
|
lodash.some(numbers, function(num) {\
|
||||||
return num == 19;\
|
return num == (limit - 1);\
|
||||||
})'
|
})'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
_.some(numbers, function(num) {\
|
_.some(numbers, function(num) {\
|
||||||
return num == 19;\
|
return num == (limit - 1);\
|
||||||
})'
|
})'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -1633,12 +1645,12 @@
|
|||||||
Benchmark.Suite('`_.some` with `thisArg` iterating an array (slow path)')
|
Benchmark.Suite('`_.some` with `thisArg` iterating an array (slow path)')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
lodash.some(objects, function(value, index) {\
|
lodash.some(objects, function(value, index) {\
|
||||||
return this["key" + index] == 19;\
|
return this["key" + index] == (limit - 1);\
|
||||||
}, object)'
|
}, object)'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
_.some(objects, function(value, index) {\
|
_.some(objects, function(value, index) {\
|
||||||
return this["key" + index] == 19;\
|
return this["key" + index] == (limit - 1);\
|
||||||
}, object)'
|
}, object)'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -1647,12 +1659,12 @@
|
|||||||
Benchmark.Suite('`_.some` iterating an object')
|
Benchmark.Suite('`_.some` iterating an object')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
lodash.some(object, function(num) {\
|
lodash.some(object, function(num) {\
|
||||||
return num == 19;\
|
return num == (limit - 1);\
|
||||||
})'
|
})'
|
||||||
)
|
)
|
||||||
.add(otherName, '\
|
.add(otherName, '\
|
||||||
_.some(object, function(num) {\
|
_.some(object, function(num) {\
|
||||||
return num == 19;\
|
return num == (limit - 1);\
|
||||||
})'
|
})'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user