Private or not Private
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
function PrivateFoo(paramOne) {
var thisIsPrivate = paramOne;
this.bar = function() {
return thisIsPrivate;
};
}
function PublicFoo(paramOne) {
this._thisIsPrivate = paramOne;
}
PublicFoo.prototype.bar = function() {
return this._thisIsPrivate;
};
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Private |
|
pending… |
Public |
|
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 andrea
- Revision 2: published
- Revision 3: published
- Revision 5: published by JohnDotAwesome
- Revision 6: published
0 comments