perf.js (lodash-4.0.0) | : | perf.js (lodash-4.17.21) | ||
---|---|---|---|---|
;(function() { | ;(function() { | |||
'use strict'; | ||||
/** Used to access the Firebug Lite panel (set by `run`). */ | /** Used to access the Firebug Lite panel (set by `run`). */ | |||
var fbPanel; | var fbPanel; | |||
/** Used as a safe reference for `undefined` in pre ES5 environments. */ | /** Used as a safe reference for `undefined` in pre ES5 environments. */ | |||
var undefined; | var undefined; | |||
/** Used as a reference to the global object. */ | /** Used as a reference to the global object. */ | |||
var root = typeof global == 'object' && global || this; | var root = typeof global == 'object' && global || this; | |||
skipping to change at line 46 | skipping to change at line 47 | |||
result = params = argv; | result = params = argv; | |||
} else if (params) { | } else if (params) { | |||
result = params; | result = params; | |||
} | } | |||
var last = result[result.length - 1]; | var last = result[result.length - 1]; | |||
result = (result.length > min && !/perf(?:\.js)?$/.test(last)) ? last : '../ lodash.js'; | result = (result.length > min && !/perf(?:\.js)?$/.test(last)) ? last : '../ lodash.js'; | |||
if (!amd) { | if (!amd) { | |||
try { | try { | |||
result = require('fs').realpathSync(result); | result = require('fs').realpathSync(result); | |||
} catch(e) {} | } catch (e) {} | |||
try { | try { | |||
result = require.resolve(result); | result = require.resolve(result); | |||
} catch(e) {} | } catch (e) {} | |||
} | } | |||
return result; | return result; | |||
}()); | }()); | |||
/** Used to match path separators. */ | /** Used to match path separators. */ | |||
var rePathSeparator = /[\/\\]/; | var rePathSeparator = /[\/\\]/; | |||
/** Used to detect primitive types. */ | /** Used to detect primitive types. */ | |||
var rePrimitive = /^(?:boolean|number|string|undefined)$/; | var rePrimitive = /^(?:boolean|number|string|undefined)$/; | |||
skipping to change at line 85 | skipping to change at line 86 | |||
var result = basename(ui.otherPath, '.js'); | var result = basename(ui.otherPath, '.js'); | |||
return result + (result == buildName ? ' (2)' : ''); | return result + (result == buildName ? ' (2)' : ''); | |||
}()); | }()); | |||
/** Used to score performance. */ | /** Used to score performance. */ | |||
var score = { 'a': [], 'b': [] }; | var score = { 'a': [], 'b': [] }; | |||
/** Used to queue benchmark suites. */ | /** Used to queue benchmark suites. */ | |||
var suites = []; | var suites = []; | |||
/** Used to resolve a value's internal [[Class]]. */ | ||||
var toString = Object.prototype.toString; | ||||
/** Detect if in a browser environment. */ | ||||
var isBrowser = isHostType(root, 'document') && isHostType(root, 'navigator'); | ||||
/** Use a single "load" function. */ | /** Use a single "load" function. */ | |||
var load = (typeof require == 'function' && !amd) | var load = (typeof require == 'function' && !amd) | |||
? require | ? require | |||
: noop; | : noop; | |||
/** Load lodash. */ | /** Load lodash. */ | |||
var lodash = root.lodash || (root.lodash = ( | var lodash = root.lodash || (root.lodash = ( | |||
lodash = load(filePath) || root._, | lodash = load(filePath) || root._, | |||
lodash = lodash._ || lodash, | lodash = lodash._ || lodash, | |||
(lodash.runInContext ? lodash.runInContext(root) : lodash), | (lodash.runInContext ? lodash.runInContext(root) : lodash), | |||
skipping to change at line 112 | skipping to change at line 107 | |||
)); | )); | |||
/** Load Underscore. */ | /** Load Underscore. */ | |||
var _ = root.underscore || (root.underscore = ( | var _ = root.underscore || (root.underscore = ( | |||
_ = load('../vendor/underscore/underscore.js') || root._, | _ = load('../vendor/underscore/underscore.js') || root._, | |||
_._ || _ | _._ || _ | |||
)); | )); | |||
/** Load Benchmark.js. */ | /** Load Benchmark.js. */ | |||
var Benchmark = root.Benchmark || (root.Benchmark = ( | var Benchmark = root.Benchmark || (root.Benchmark = ( | |||
Benchmark = load('../vendor/benchmark.js/benchmark.js') || root.Benchmark, | Benchmark = load('../node_modules/benchmark/benchmark.js') || root.Benchmark , | |||
Benchmark = Benchmark.Benchmark || Benchmark, | Benchmark = Benchmark.Benchmark || Benchmark, | |||
Benchmark.runInContext(lodash.extend({}, root, { '_': lodash })) | Benchmark.runInContext(lodash.extend({}, root, { '_': lodash })) | |||
)); | )); | |||
/*--------------------------------------------------------------------------*/ | /*--------------------------------------------------------------------------*/ | |||
/** | /** | |||
* Gets the basename of the given `filePath`. If the file `extension` is passe d, | * Gets the basename of the given `filePath`. If the file `extension` is passe d, | |||
* it will be removed from the basename. | * it will be removed from the basename. | |||
* | * | |||
skipping to change at line 568 | skipping to change at line 563 | |||
'fn': '_chaining.map(square).filter(even).take(100).value()', | 'fn': '_chaining.map(square).filter(even).take(100).value()', | |||
'teardown': 'function chaining(){}' | 'teardown': 'function chaining(){}' | |||
}) | }) | |||
); | ); | |||
/*--------------------------------------------------------------------------*/ | /*--------------------------------------------------------------------------*/ | |||
suites.push( | suites.push( | |||
Benchmark.Suite('`_.assign`') | Benchmark.Suite('`_.assign`') | |||
.add(buildName, { | .add(buildName, { | |||
'fn': 'lodashAssign({}, object)', | 'fn': 'lodashAssign({}, { "a": 1, "b": 2, "c": 3 })', | |||
'teardown': 'function assign(){}' | 'teardown': 'function assign(){}' | |||
}) | }) | |||
.add(otherName, { | .add(otherName, { | |||
'fn': '_assign({}, object)', | 'fn': '_assign({}, { "a": 1, "b": 2, "c": 3 })', | |||
'teardown': 'function assign(){}' | 'teardown': 'function assign(){}' | |||
}) | }) | |||
); | ); | |||
suites.push( | suites.push( | |||
Benchmark.Suite('`_.assign` with multiple sources') | Benchmark.Suite('`_.assign` with multiple sources') | |||
.add(buildName, { | .add(buildName, { | |||
'fn': 'lodashAssign({}, object, object)', | 'fn': 'lodashAssign({}, { "a": 1, "b": 2 }, { "c": 3, "d": 4 })', | |||
'teardown': 'function assign(){}' | 'teardown': 'function assign(){}' | |||
}) | }) | |||
.add(otherName, { | .add(otherName, { | |||
'fn': '_assign({}, object, object)', | 'fn': '_assign({}, { "a": 1, "b": 2 }, { "c": 3, "d": 4 })', | |||
'teardown': 'function assign(){}' | 'teardown': 'function assign(){}' | |||
}) | }) | |||
); | ); | |||
/*--------------------------------------------------------------------------*/ | /*--------------------------------------------------------------------------*/ | |||
suites.push( | suites.push( | |||
Benchmark.Suite('`_.bind` (slow path)') | Benchmark.Suite('`_.bind` (slow path)') | |||
.add(buildName, { | .add(buildName, { | |||
'fn': 'lodash.bind(function() { return this.name; }, { "name": "fred" }) ', | 'fn': 'lodash.bind(function() { return this.name; }, { "name": "fred" }) ', | |||
End of changes. 9 change blocks. | ||||
13 lines changed or deleted | 8 lines changed or added |