From 5b9271ccfeffcb65981cb4fdc9f12eb46a36d1f9 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 21 Aug 2012 01:59:56 -0700 Subject: [PATCH] Add isType benchmarks. Former-commit-id: 875af51200d60eb6105eb36ab090e9f307a15340 --- perf/perf.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/perf/perf.js b/perf/perf.js index 3b8534830..314829238 100644 --- a/perf/perf.js +++ b/perf/perf.js @@ -154,7 +154,9 @@ belt = this.name == "Lo-Dash" ? lodash : _;\ \ var index,\ + date = new Date,\ limit = 20,\ + regexp = /x/,\ object = {},\ objects = Array(limit),\ numbers = Array(limit),\ @@ -941,6 +943,36 @@ /*--------------------------------------------------------------------------*/ + suites.push( + Benchmark.Suite('`_.isArguments`, `_.isDate`, `_.isFunction`, `_.isNumber`, `_.isRegExp`') + .add('Lo-Dash', '\ + lodash.isArguments(arguments);\ + lodash.isArguments(object);\ + lodash.isDate(date);\ + lodash.isDate(object);\ + lodash.isFunction(lodash);\ + lodash.isFunction(object);\ + lodash.isNumber(1);\ + lodash.isNumber(object);\ + lodash.isRegExp(regexp);\ + lodash.isRegExp(object);' + ) + .add('Underscore', '\ + _.isArguments(arguments);\ + _.isArguments(object);\ + _.isDate(date);\ + _.isDate(object);\ + _.isFunction(_);\ + _.isFunction(object);\ + _.isNumber(1);\ + _.isNumber(object);\ + _.isRegExp(regexp);\ + _.isRegExp(object);' + ) + ); + + /*--------------------------------------------------------------------------*/ + suites.push( Benchmark.Suite('`_.keys` (uses native `Object.keys` if available)') .add('Lo-Dash', '\