Object vs. Seal vs. Freeze
JavaScript performance comparison
Info
I was wondering why my tests took much more time than average.
Seal was adding more security… but more latency too.
Preparation code
<script>
Benchmark.prototype.setup = function() {
function thrower(){
throw new Error('nope');
}
var frozenHandler = {
set: thrower,
defineProperty: thrower,
delete: thrower
};
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Regular Object Constructor |
|
pending… |
Sealing Object Constructor |
|
pending… |
Freezing Object Constructor |
|
pending… |
Proxy-based freezing |
|
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 Oncle Tom
- Revision 2: published by David Bruant
0 comments