Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
objct1 vs function1
(version: 1)
Comparing performance of:
function vs object
Created:
one year ago
by:
Guest
Go 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); for (i = 0; i < 1000; i++) { ob.add(); }
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:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Browser/OS:
Firefox 133 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
object
289K/s
function
84K/s
View exact numbers
Test name
Executions per second
✓
object
288,716 Ops/sec
function
84,486 Ops/sec
Related benchmarks
creation
Class vs Function
Object Assignment vs DefineProperties
objct vs function
Comments
Confirm delete:
Do you really want to delete benchmark?