silly conditional
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var c = [123, 35, 92, 213, 0, 45, 58, 84, 35, 78]
var fnc = {
123: function () {},
35: function () {},
92: function () {},
213: function () {},
0: function () {},
45: function () {},
58: function () {console.log('match fnc')},
84: function () {},
35: function () {},
78: function () {}
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
if |
|
pending… |
function |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments