React Aria · production benchmark
/*
* Copyright 2026 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
import {
Button,
Cell,
Checkbox,
Column,
ComboBox,
Input,
Label,
ListBox,
ListBoxItem,
Popover,
ResizableTableContainer,
Row,
Switch,
Table,
TableBody,
TableHeader,
TableLayout,
TextField,
Virtualizer
} from 'react-aria-components';
import {
CellTableFixture,
DataTableFixture,
OptionContent,
OptionList,
SelectFixture
} from './collections';
import {createRoot} from 'react-dom/client';
import {DndFixture} from './dnd';
import {InfiniteTableFixture, ReorderFixture} from './workflows';
import {measurement} from './measure';
import {MeasuredTableFixture} from './measured-table';
import {MutationFixture, ProjectNode, TreeFixture, VariableFixture} from './advanced-collections';
import React, {useState} from 'react';
import {sizes} from '../scenarios.mjs';
import './styles.css';
const params = new URLSearchParams(location.search);
const fixture = params.get('fixture') ?? 'listbox';
const size = Number(params.get('size') ?? sizes[fixture]);
const delay = Number(params.get('delay') ?? 0);
const delayMode = params.get('delayMode') ?? 'sync';
const items = Array.from({length: size}, (_, i) => ({
id: `item-${i}`,
index: i,
name: `Record ${i}`,
owner: `Team ${i % 12}`,
status: i % 3 === 0 ? 'Review' : 'Active',
amount: `$${100 + i}`,
date: 'Oct 14, 2026',
category: `Category ${i % 8}`
}));
// Local payloads are prepared before mounting, as if the data has already arrived.
const projectRecords = ['variable', 'collection'].includes(fixture)
? items.map(item => ({
id: item.id,
name: item.name,
description:
fixture === 'variable'
? 'Review the project requirements, coordinate with the design team, and prepare the next release. '
.repeat(1 + (item.index % 3))
.trim()
: `${item.owner} · ${item.status}`
}))
: [];
const nextPage =
fixture === 'collection'
? Array.from({length: size / 2}, (_, i) => ({
id: `item-${size + i}`,
name: `Record ${size + i}`,
description: 'Next page · Active'
}))
: [];
const replacement =
fixture === 'collection'
? projectRecords.map((item, i) => ({
...item,
id: `replacement-${i}`,
name: `New record ${i}`
}))
: [];
const projects: ProjectNode[] =
fixture === 'tree'
? Array.from({length: 20}, (_, i) => ({
id: `project-${i}`,
name: `Project ${i}`,
children: Array.from({length: size / 20}, (_, j) => ({
id: `file-${i}-${j}`,
name: `File ${i}-${j}`
}))
}))
: [];
// Mount calibration delays the update itself; other modes are injected by measure.ts.
function withCalibration(update: () => void) {
if (!['sync', 'deferred', 'layout'].includes(delayMode)) {
update();
return;
}
if (delayMode === 'deferred' && delay > 0) {
setTimeout(update, delay);
return;
}
let end = performance.now() + delay;
let probe: HTMLDivElement | undefined;
if (delayMode === 'layout' && delay) {
probe = document.createElement('div');
probe.className = 'layout-probe';
document.body.append(probe);
}
let n = 0;
while (performance.now() < end) {
if (probe) {
probe.style.width = `${100 + (n++ % 100)}px`;
probe.getBoundingClientRect();
}
}
probe?.remove();
update();
}
function ListFixture() {
let [revision, setRevision] = useState(0);
return (
<>
setSelected(keys === 'all' ? 'all' : String(keys.size))}
data-bench="records-table">
React Aria · production benchmark