mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Allow external scripts to be specified and run in the perf suite.
Former-commit-id: 474f0a24d54c800830e2bcec98f6536a17a12bfb
This commit is contained in:
@@ -34,13 +34,13 @@
|
|||||||
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
|
<script src="../vendor/firebug-lite/src/firebug-lite-debug.js"></script>
|
||||||
<script src="perf-ui.js"></script>
|
<script src="perf-ui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.write('<script src="../' + ui.buildPath + '"><\/script>');
|
document.write('<script src="' + ui.buildPath + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var lodash = _.noConflict();
|
var lodash = _.noConflict();
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
document.write('<script src="../' + ui.otherPath + '"><\/script>');
|
document.write('<script src="' + ui.otherPath + '"><\/script>');
|
||||||
</script>
|
</script>
|
||||||
<script src="perf.js"></script>
|
<script src="perf.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
;(function(window) {
|
;(function(window) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/** The base path of the builds */
|
||||||
|
var basePath = '../';
|
||||||
|
|
||||||
/** The Lo-Dash build to load */
|
/** The Lo-Dash build to load */
|
||||||
var build = (/build=([^&]+)/.exec(location.search) || [])[1];
|
var build = (/build=([^&]+)/.exec(location.search) || [])[1];
|
||||||
|
|
||||||
@@ -33,28 +36,36 @@
|
|||||||
|
|
||||||
// expose Lo-Dash build file path
|
// expose Lo-Dash build file path
|
||||||
ui.buildPath = (function() {
|
ui.buildPath = (function() {
|
||||||
|
var result;
|
||||||
switch (build) {
|
switch (build) {
|
||||||
case 'lodash-compat': return 'dist/lodash.compat.min.js';
|
case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
|
||||||
case 'lodash-mobile': return 'dist/lodash.mobile.min.js';
|
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
|
||||||
case 'lodash-underscore': return 'dist/lodash.underscore.min.js';
|
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
|
||||||
case 'lodash-custom-dev': return 'lodash.custom.js';
|
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
|
||||||
case 'lodash-custom': return 'lodash.custom.min.js';
|
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
|
||||||
|
case 'lodash-modern':
|
||||||
|
case undefined: result = 'dist/lodash.min.js'; break;
|
||||||
|
default: result = build;
|
||||||
}
|
}
|
||||||
return 'dist/lodash.min.js';
|
return result == build ? result : (basePath + result);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// expose other library file path
|
// expose other library file path
|
||||||
ui.otherPath = (function() {
|
ui.otherPath = (function() {
|
||||||
|
var result;
|
||||||
switch (other) {
|
switch (other) {
|
||||||
case 'lodash-compat': return 'dist/lodash.compat.min.js';
|
case 'lodash-compat': result = 'dist/lodash.compat.min.js'; break;
|
||||||
case 'lodash-mobile': return 'dist/lodash.mobile.min.js';
|
case 'lodash-mobile': result = 'dist/lodash.mobile.min.js'; break;
|
||||||
case 'lodash-modern': return 'dist/lodash.min.js';
|
case 'lodash-modern': result = 'dist/lodash.min.js'; break;
|
||||||
case 'lodash-underscore': return 'dist/lodash.underscore.min.js';
|
case 'lodash-underscore': result = 'dist/lodash.underscore.min.js'; break;
|
||||||
case 'lodash-custom-dev': return 'lodash.custom.js';
|
case 'lodash-custom-dev': result = 'lodash.custom.js'; break;
|
||||||
case 'lodash-custom': return 'lodash.custom.min.js';
|
case 'lodash-custom': result = 'lodash.custom.min.js'; break;
|
||||||
case 'underscore-dev': return 'vendor/underscore/underscore.js';
|
case 'underscore-dev': result = 'vendor/underscore/underscore.js'; break;
|
||||||
|
case 'underscore':
|
||||||
|
case undefined: result = 'vendor/underscore/underscore-min.js'; break;
|
||||||
|
default: result = other;
|
||||||
}
|
}
|
||||||
return 'vendor/underscore/underscore-min.js';
|
return result == other ? result : (basePath + result);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// initialize controls
|
// initialize controls
|
||||||
|
|||||||
13
perf/perf.js
13
perf/perf.js
@@ -192,10 +192,12 @@
|
|||||||
var bench = this[index];
|
var bench = this[index];
|
||||||
if (bench.error) {
|
if (bench.error) {
|
||||||
var errored = true;
|
var errored = true;
|
||||||
log(bench.error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!errored) {
|
if (errored) {
|
||||||
|
log('There was a problem, skipping...');
|
||||||
|
}
|
||||||
|
else {
|
||||||
var formatNumber = Benchmark.formatNumber,
|
var formatNumber = Benchmark.formatNumber,
|
||||||
fastest = this.filter('fastest'),
|
fastest = this.filter('fastest'),
|
||||||
fastestHz = getHz(fastest[0]),
|
fastestHz = getHz(fastest[0]),
|
||||||
@@ -290,8 +292,11 @@
|
|||||||
\
|
\
|
||||||
if (typeof bindAll != "undefined") {\
|
if (typeof bindAll != "undefined") {\
|
||||||
var bindAllCount = -1,\
|
var bindAllCount = -1,\
|
||||||
bindAllObjects = Array(this.count),\
|
bindAllObjects = Array(this.count);\
|
||||||
funcNames = belt.functions(belt).slice(0, 40);\
|
\
|
||||||
|
var funcNames = belt.reject(belt.functions(belt).slice(0, 40), function(funcName) {\
|
||||||
|
return /^_/.test(funcName);\
|
||||||
|
});\
|
||||||
\
|
\
|
||||||
// potentially expensive\n\
|
// potentially expensive\n\
|
||||||
for (index = 0; index < this.count; index++) {\
|
for (index = 0; index < this.count; index++) {\
|
||||||
|
|||||||
Reference in New Issue
Block a user