One liner or temp vars
JavaScript performance comparison
Preparation code
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.min.js"></script>
<script>
Benchmark.prototype.setup = function() {
var stateMachine = [
{
wiz1: {
Forward: 'wiz2',
Backward: null,
Boogie: 'wiz1'
},
wiz2: {
Forward: 'wiz3',
Backward: 'wiz1',
Boogie: 'wiz2',
Spruce: 'wiz1'
},
wiz3: {
Forward: 'wiz4',
Backward: 'wiz2',
Boogie: 'wiz3'
},
wiz4: {
Forward: null,
Backward: 'wiz3',
Boogie: 'wiz4'
}
},
{
clean: {
Dirty: 'dirty'
},
dirty: {
Clean: 'clean',
Boogie: 'clean',
Spruce: 'spiffy'
},
spiffy: {
Dirty: 'dirty'
}
}
]
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
One liner |
|
pending… |
Multiline |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments