Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
useCallback vs without
(version: 1)
Comparing performance of:
without vs usecallback
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!doctype html> <html> <head> <title>This is the title of the webpage!</title> </head> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.13.1/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.13.1/umd/react-dom.production.min.js"></script> <div id="root"></div> </body> </html>
Script Preparation code:
function ComponentWithUseCallback() { const testFunction = React.useCallback(evt => evt.preventDefault(), []); return React.createElement('button', {onClick: testFunction}, 'Test click'); } function ComponentWithoutUseCallback() { const testFunction = evt => evt.preventDefault(); return React.createElement('button', {onClick: testFunction}, 'Test click'); }
Tests:
without
ReactDOM.render(React.createElement(ComponentWithUseCallback), document.getElementById('root'))
usecallback
ReactDOM.render(React.createElement(ComponentWithoutUseCallback), document.getElementById('root'))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
without
usecallback
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
without
1110103.6 Ops/sec
usecallback
866933.8 Ops/sec
Related benchmarks:
React useCallback hook vs. function
React useCallback
React 17 useCallback
React 18.2 useCallback hook vs. function
ROUND1: React useCallback vs notUseCallback
Test: React useCallback vs notUseCallback
React17: React useCallback vs notUseCallback
React useCallback hook vs. function 18
React useCallback hook vs. function 2
Comments
Confirm delete:
Do you really want to delete benchmark?