Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Reassignment of Var vs Const vs Let
(version: 2)
Comparing performance of:
Var vs Const vs Let vs Const from inline function
Created:
11 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
Var
function foo() { var x = { value: 10 } x = { value: 11 } }
Const
function foo() { const x = { value: 10 } x.value = 11 }
Let
function foo() { let x = { value: 10 } x = { value: 11 } }
Const from inline function
function foo() { const bar = () => { const x = {value: 11} } const y = bar() }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Var
Const
Let
Const from inline function
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
11 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Var
284707168.0 Ops/sec
Const
249601200.0 Ops/sec
Let
261721552.0 Ops/sec
Const from inline function
259947328.0 Ops/sec
Related benchmarks:
Assigning new variable
Nullish vs If
JS Variable Performance (const vs let vs var)
js mul vs pow
String literal vs Template literal assignment
set vs uniq
Test direct and destructuring performances
test-string-1
classNames
Comments
Confirm delete:
Do you really want to delete benchmark?