Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Function declaration vs Function expression in React
(version: 0)
Benchmark.js
Comparing performance of:
function expression vs function declaration
Created:
3 years ago
by:
Guest
Go to the latest result
HTML Preparation code:
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script> <div id="dest"></div>
Tests:
function expression
const Hello = ({toWhat}) => React.createElement('div', null, `Hello ${toWhat}`); ReactDOM.render( React.createElement(Hello, {toWhat: 'World'}, null), document.getElementById('dest') );
function declaration
function Hello ({toWhat}) { return React.createElement('div', null, `Hello ${toWhat}`); } ReactDOM.render( React.createElement(Hello, {toWhat: 'World'}, null), document.getElementById('dest') );
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
function expression
function declaration
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser/OS:
Chrome 136 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
function expression
124K/s
function declaration
83K/s
View exact numbers
Test name
Executions per second
✓
function expression
124,349 Ops/sec
function declaration
83,247 Ops/sec
Related benchmarks
React Const vs Function - fixed
React const vs function 2024 (swapped order)
Comments
Confirm delete:
Do you really want to delete benchmark?