8000 Add isType benchmarks. · lodash/lodash@5b9271c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5b9271c

Browse files
committed
Add isType benchmarks.
Former-commit-id: 875af51200d60eb6105eb36ab090e9f307a15340
1 parent e60bbc2 commit 5b9271c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

perf/perf.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@
154154
belt = this.name == "Lo-Dash" ? lodash : _;\
155155
\
156156
var index,\
157+
date = new Date,\
157158
limit = 20,\
159+
regexp = /x/,\
158160
object = {},\
159161
objects = Array(limit),\
160162
numbers = Array(limit),\
@@ -941,6 +943,36 @@
941943

942944
/*--------------------------------------------------------------------------*/
943945

946+
suites.push(
947+
Benchmark.Suite('`_.isArguments`, `_.isDate`, `_.isFunction`, `_.isNumber`, `_.isRegExp`')
948+
.add('Lo-Dash', '\
949+
lodash.isArguments(arguments);\
950+
lodash.isArguments(object);\
951+
lodash.isDate(date);\
952+
lodash.isDate(object);\
953+
lodash.isFunction(lodash);\
954+
lodash.isFunction(object);\
955+
lodash.isNumber(1);\
956+
lodash.isNumber(object);\
957+
lodash.isRegExp(regexp);\
958+
lodash.isRegExp(object);'
959+
)
960+
.add('Underscore', '\
961+
_.isArguments(arguments);\
962+
_.isArguments(object);\
963+
_.isDate(date);\
964+
_.isDate(object);\
965+
_.isFunction(_);\
966+
_.isFunction(object);\
967+
_.isNumber(1);\
968+
_.isNumber(object);\
969+
_.isRegExp(regexp);\
970+
_.isRegExp(object);'
971+
)
972+
);
973+
974+
/*--------------------------------------------------------------------------*/
975+
944976
suites.push(
945977
Benchmark.Suite('`_.keys` (uses native `Object.keys` if available)')
946978
.add('Lo-Dash', '\

0 commit comments

Comments
 (0)
0