nicer option valuating?
JavaScript performance comparison
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
var flow;
var aniConf1 = {
flow: "left"
};
var aniConf2 = {
flow: "right"
};
var aniConf3 = null;
var aniConf4 = {
flowFalse: "top"
};
function method1(conf) {
flow = (jQuery.extend({
flow: "left"
}, conf)).flow;
}
function method2(conf) {
if (conf != null && conf.flow != null) {
flow = conf.flow;
}
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
with jQuery.extend |
|
pending… |
basic if |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments