Skip to content

Commit 30828c5

Browse files
committed
fix(bench): use lazy useState initializers in octane-tsrx fixture
Pass initialTopo/initialCharts/initialUi as function references instead of eagerly calling them, matching the React fixture's lazy form. The eager calls evaluated on every render, creating allocation work that skewed benchmark timings against Octane.
1 parent 2c1d892 commit 30828c5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • benchmarks/svg-dashboard/octane-tsrx/src

‎benchmarks/svg-dashboard/octane-tsrx/src/App.tsrx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function IconLayer({ icons }: { icons: IconRow[] }) @{
228228
// subtrees arrive as descriptor props built by App, which only re-renders on
229229
// topo/charts commits — so ui commits touch just these few bindings.
230230
function Viewport({ defs, layers }: { defs: OctaneNode; layers: OctaneNode }) @{
231-
const [ui, setUi] = useState(initialUi());
231+
const [ui, setUi] = useState(initialUi);
232232
const overlayRef = useRef<Element | null>(null);
233233
bindSetters({ setUi });
234234

@@ -246,8 +246,8 @@ function Viewport({ defs, layers }: { defs: OctaneNode; layers: OctaneNode }) @{
246246
}
247247

248248
export default function App() @{
249-
const [topo, setTopo] = useState(initialTopo());
250-
const [charts, setCharts] = useState(initialCharts());
249+
const [topo, setTopo] = useState(initialTopo);
250+
const [charts, setCharts] = useState(initialCharts);
251251
bindSetters({ setTopo, setCharts });
252252

253253
<Viewport

0 commit comments

Comments
 (0)