Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
objct2 vs function2
(version: 1)
Comparing performance of:
function vs object
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
pr=function(){ let a=0; this.add=()=>{ a+=1; } } const pro={ a:0, add(){ const $=this; $.a+=1; } }
Tests:
function
k = new pr(); for (i = 0; i < 1000; i++) { k.add(); }
object
const ob=Object.assign({},pro); ob.add2=function(){ const $=this; $.a+=1; }; for (i = 0; i < 1000; i++) { ob.adds(); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
function
object
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?