Function vs. Inline
JavaScript performance comparison
Preparation code
<script>
runs = 1000;
var testerFunction = function(i) {
return runs + i;
}
var testerFunction2 = function(i) {
var a = runs + i;
return a * 2;
}
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
function call single |
|
pending… |
inline single |
|
pending… |
function call double |
|
pending… |
inline double |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Mike Grace and last updated
- Revision 2: published by Mario Klingemann
0 comments