Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
useMemo and memoa test
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
No Memo
19746.7 Ops/sec
UseMemoAlone
19139.0 Ops/sec
HTML Preparation code:
<div id="root"></div> <script src="https://unpkg.com/react@16/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.15/lodash.min.js"></script>
Script Preparation code:
function ChildComponent(props) { return React.createElement("div", props); } const a = { width: "4px", height: "5px" } function UseMemoAlone(props) { const handler = React.useMemo(() => { return { ...a, background: "black" } }, []); return React.createElement(ChildComponent, { style: handler }); } function NoMemo(props) { const handler = { ...a, background: "black" }; return React.createElement(ChildComponent, { style: handler }); } var propCases = [{ handler: function() { return Math.random(); }, wait: 100 }, { handler: function() { return Math.random(); }, wait: 200 }]; propCases.push(propCases[1]);
Tests:
No Memo
propCases.forEach((props) => { ReactDOM.render(React.createElement(NoMemo, props, null), root); });
UseMemoAlone
propCases.forEach((props) => { ReactDOM.render(React.createElement(UseMemoAlone, props, null), root); });