jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
Tests on how to load json object into existing object
<script>
A = function(){
//ref to self
Object.defineProperty(this, "self",
{value : null,
writable : true,
enumerable : false,
configurable : true});
this.self=this;
this.Astring = "This is a string"
this.Anumber = 42
this.overwriteData=function(data){
for(prop in data){
self[prop]=data[prop]
}
}
this.redirrectData=function(data){
for(prop in data){
self[prop]=function(){
self[prop]
}
}
}
}
dataOBJ = JSON.parse(JSON.stringify(new A()))
Test1 = new A() //control
Test2 = new A() //overwrite Data
Test2.overwriteData(dataOBJ)
Test3 = new A() //redirrect Data
Test3.redirrectData(dataOBJ)
dataOBJ = null;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Native Scope Reading |
| ready |
Replaced Vars |
| ready |
Redirected using functions |
| ready |
Population-Overwrite |
| ready |
Population-Redirect |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.