// Copyright 2026 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { useUpdateBenchmarkCompletion } from './UpdateBenchmark.js';
const ITEM_IDS = Array.from({ length: 100 }, (_, index) => index);
const TARGET_ITEM_ID = 50;
interface UpdateBenchmarkProps {
caseFilePath: string;
readUpdated: () => boolean;
}
// Invoke the reader in this leaf so the signal variant subscribes here instead
// of rerendering the static parent tree.
function LocalAttributeUpdateTarget({
caseFilePath,
readUpdated,
}: UpdateBenchmarkProps) {
const updated = readUpdated();
const benchmarkFinished = useUpdateBenchmarkCompletion(
caseFilePath,
updated,
);
return (
);
}
export function LocalAttributeUpdateBenchmark({
caseFilePath,
readUpdated,
}: UpdateBenchmarkProps) {
return (
{ITEM_IDS.map(itemId =>
itemId === TARGET_ITEM_ID
? (
)
:
)}
);
}
export function FullAttributeUpdateBenchmark({
caseFilePath,
readUpdated,
}: UpdateBenchmarkProps) {
return (
{ITEM_IDS.map(itemId => (
))}
);
}
function FullAttributeUpdateItem({
itemId,
readUpdated,
}: {
itemId: number;
readUpdated: () => boolean;
}) {
const updated = readUpdated();
return (
);
}
function FullAttributeUpdateCompletion({
caseFilePath,
readUpdated,
}: UpdateBenchmarkProps) {
const updated = readUpdated();
const benchmarkFinished = useUpdateBenchmarkCompletion(
caseFilePath,
updated,
);
return ;
}