Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changeset/calm-zebras-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

---
32 changes: 32 additions & 0 deletions benchmark/react/cases/008-many-use-state/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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 { root, useState } from '@lynx-js/react';

import { RunBenchmarkUntilHydrate } from '../../src/RunBenchmarkUntil.js';

function Item() {
const [counter] = useState(0);
return counter === 1 ? <text>{counter}</text> : null;
}
function App() {
return (
<view>
{Array.from({
length: 1000,
}).map(() => {
return <Item />;
})}
</view>
);
}

runAfterLoadScript(() => {
root.render(
<>
<App />
<RunBenchmarkUntilHydrate />
</>,
);
});
4 changes: 4 additions & 0 deletions benchmark/react/lynx.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export default defineConfig({
'./src/patchProfile.ts',
'./cases/007-four-layer-views/index.tsx',
],
'008-many-use-state': [
'./src/patchProfile.ts',
'./cases/008-many-use-state/index.tsx',
],
},
},
plugins: [
Expand Down
2 changes: 2 additions & 0 deletions benchmark/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"bench:005-load-script": "benchx_cli run dist/005-load-script.lynx.bundle",
"bench:006-static-raw-text": "benchx_cli run dist/006-static-raw-text.lynx.bundle --wait-for-id=stop-benchmark-true",
"bench:007-four-layer-views": "benchx_cli run dist/007-four-layer-views.lynx.bundle --wait-for-id=stop-benchmark-true",
"bench:008-many-use-state": "benchx_cli run dist/008-many-use-state.lynx.bundle --wait-for-id=stop-benchmark-true",
"build": "rspeedy build",
"dev": "rspeedy dev",
"perfetto": "pnpm run --sequential --stream --aggregate-output '/^perfetto:.*/'",
Expand All @@ -22,6 +23,7 @@
"perfetto:005-load-script": "benchx_cli -o dist/005-load-script.ptrace run dist/005-load-script.lynx.bundle",
"perfetto:006-static-raw-text": "benchx_cli -o dist/006-static-raw-text.ptrace run dist/006-static-raw-text.lynx.bundle --wait-for-id=stop-benchmark-true",
"perfetto:007-four-layer-views": "benchx_cli -o dist/007-four-layer-views.ptrace run dist/007-four-layer-views.lynx.bundle --wait-for-id=stop-benchmark-true",
"perfetto:008-many-use-state": "benchx_cli -o dist/008-many-use-state.ptrace run dist/008-many-use-state.lynx.bundle --wait-for-id=stop-benchmark-true",
"test": "npm run perfetto && node scripts/detectLeak.mjs"
},
"dependencies": {
Expand Down
Loading