If/switch case
JavaScript performance comparison
Test case created
Preparation code
<script>
Benchmark.prototype.setup = function() {
func = 'complete';
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Testing in unknown unknown
| Test |
Ops/sec |
if |
if(func == 'focus') {return;} if(func == 'blur') {return;} if(func == 'select') {return;} if(func == 'switchStateOfFieldButton'){return;} if(func == 'clear') {return;} if(func == 'hideValueOfTextField') {return;} if(func == 'restoreValueOfTextField') {return;} if(func == 'setDate') {return;} if(func == 'setFlightType') {return;} if(func == 'error') {return;} if(func == 'complete') {return;}
|
pending… |
else if |
if(func == 'focus') {return;} else if(func == 'blur') {return;} else if(func == 'select') {return;} else if(func == 'switchStateOfFieldButton'){return;} else if(func == 'clear') {return;} else if(func == 'hideValueOfTextField') {return;} else if(func == 'restoreValueOfTextField') {return;} else if(func == 'setDate') {return;} else if(func == 'setFlightType') {return;} else if(func == 'error') {return;} else if(func == 'complete') {return;}
|
pending… |
switch |
switch(func){ case 'focus': break; case 'blur': break; case 'select': break; case 'switchStateOfFieldButton': break; case 'clear': break; case 'hideValueOfTextField': break; case 'restoreValueOfTextField': break; case 'setDate': break; case 'setFlightType': break; case 'error': break; case 'complete': break; }
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
Compare results of other browsers
0 comments