Function calls vs inline
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var m = 1;
var o = 1;
var p = 1;
var q = 1;
var r = 1;
var s = 1;
function test() {
m++;
o++;
p++;
q++;
r++;
s++;
}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
function call |
|
pending… |
inline |
|
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 Function calls vs inline
- Revision 2: published
1 comment
IE 9 is faster with funciton calls... what?!?