mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Make perf-ui.js and test-ui.js more aligned, remove unzip perf test, and handle comparing to files of the same name in perf.js.
Former-commit-id: 7a5353aab76d6667b6dd5d43e85f95695e5a9cba
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
* @param {Function} handler The event handler.
|
* @param {Function} handler The event handler.
|
||||||
* @returns {Element} The element.
|
* @returns {Element} The element.
|
||||||
*/
|
*/
|
||||||
function addEvent(element, eventName, handler) {
|
function addListener(element, eventName, handler) {
|
||||||
if (typeof element.addEventListener != 'undefined') {
|
if (typeof element.addEventListener != 'undefined') {
|
||||||
element.addEventListener(eventName, handler, false);
|
element.addEventListener(eventName, handler, false);
|
||||||
} else if (typeof element.attachEvent != 'undefined') {
|
} else if (typeof element.attachEvent != 'undefined') {
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
}());
|
}());
|
||||||
|
|
||||||
// initialize controls
|
// initialize controls
|
||||||
addEvent(window, 'load', function() {
|
addListener(window, 'load', function() {
|
||||||
function eventHandler(event) {
|
function eventHandler(event) {
|
||||||
var search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, '');
|
var search = location.search.replace(/^\?|&?(?:build|other)=[^&]*&?/g, '');
|
||||||
if (event.stopPropagation) {
|
if (event.stopPropagation) {
|
||||||
|
|||||||
22
perf/perf.js
22
perf/perf.js
@@ -76,7 +76,10 @@
|
|||||||
var buildName = window.buildName = basename(ui.buildPath, '.js');
|
var buildName = window.buildName = basename(ui.buildPath, '.js');
|
||||||
|
|
||||||
/** The other library basename */
|
/** The other library basename */
|
||||||
var otherName = window.otherName = basename(ui.otherPath, '.js');
|
var otherName = window.otherName = (function() {
|
||||||
|
var result = basename(ui.otherPath, '.js');
|
||||||
|
return result + (result == buildName ? ' (2)' : '');
|
||||||
|
}());
|
||||||
|
|
||||||
/** Detect if in a browser environment */
|
/** Detect if in a browser environment */
|
||||||
var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');
|
var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');
|
||||||
@@ -527,8 +530,7 @@
|
|||||||
whereObject = { "num": 9 };\
|
whereObject = { "num": 9 };\
|
||||||
}\
|
}\
|
||||||
if (typeof zip != "undefined") {\
|
if (typeof zip != "undefined") {\
|
||||||
var unzipped = [["a", "b", "c"], [1, 2, 3], [true, false, true]],\
|
var unzipped = [["a", "b", "c"], [1, 2, 3], [true, false, true]];\
|
||||||
zipped = [["a", 1, true], ["b", 2, false], ["c", 3, true]];\
|
|
||||||
}'
|
}'
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1828,20 +1830,6 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
suites.push(
|
|
||||||
Benchmark.Suite('`_.unzip`')
|
|
||||||
.add(buildName, {
|
|
||||||
'fn': 'lodash.unzip(zipped)',
|
|
||||||
'teardown': 'function zip(){}'
|
|
||||||
})
|
|
||||||
.add(otherName, {
|
|
||||||
'fn': '_.unzip(zipped)',
|
|
||||||
'teardown': 'function zip(){}'
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
suites.push(
|
suites.push(
|
||||||
Benchmark.Suite('`_.values`')
|
Benchmark.Suite('`_.values`')
|
||||||
.add(buildName, '\
|
.add(buildName, '\
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
* @param {Function} handler The event handler.
|
* @param {Function} handler The event handler.
|
||||||
* @returns {Element} The element.
|
* @returns {Element} The element.
|
||||||
*/
|
*/
|
||||||
function addEvent(element, eventName, handler) {
|
function addListener(element, eventName, handler) {
|
||||||
if (typeof element.addEventListener != 'undefined') {
|
if (typeof element.addEventListener != 'undefined') {
|
||||||
element.addEventListener(eventName, handler, false);
|
element.addEventListener(eventName, handler, false);
|
||||||
} else if (typeof element.attachEvent != 'undefined') {
|
} else if (typeof element.attachEvent != 'undefined') {
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
}());
|
}());
|
||||||
|
|
||||||
// initialize controls
|
// initialize controls
|
||||||
addEvent(window, 'load', function() {
|
addListener(window, 'load', function() {
|
||||||
function eventHandler(event) {
|
function eventHandler(event) {
|
||||||
var search = location.search.replace(/^\?|&?(?:build|loader)=[^&]*&?/g, '');
|
var search = location.search.replace(/^\?|&?(?:build|loader)=[^&]*&?/g, '');
|
||||||
if (event.stopPropagation) {
|
if (event.stopPropagation) {
|
||||||
@@ -123,8 +123,8 @@
|
|||||||
return -1;
|
return -1;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
addEvent(buildList, 'change', eventHandler);
|
addListener(buildList, 'change', eventHandler);
|
||||||
addEvent(loaderList, 'change', eventHandler);
|
addListener(loaderList, 'change', eventHandler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setTimeout(init, 15);
|
setTimeout(init, 15);
|
||||||
|
|||||||
Reference in New Issue
Block a user