Nested Named Functions
JavaScript performance comparison
Info
Demonstrating the performance hit caused by nested functions.
Preparation code
<script>
function foo(a, b) {
function bar() {
return a + b;
}
return bar();
}
function foo2(a, b) {
return bar2(a, b);
}
function bar2(a, b) {
return a + b;
}
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Optimized (No Nesting) |
|
pending… |
Nested Function |
|
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 3: published by gdsf
- Revision 4: published
- Revision 5: published by gdsf
- Revision 6: published
- Revision 7: published
- Revision 9: published
- Revision 10: published
- Revision 13: published
- Revision 14: published
- Revision 15: published
- Revision 16: published
- Revision 17: published
- Revision 18: published
- Revision 19: published
- Revision 20: published
- Revision 21: published
- Revision 22: published
- Revision 23: published
- Revision 24: published by max jooher
0 comments