Skip to content

Commit c1225ac

Browse files
authored
test: add static text case for bench (#1906)
<!-- Thank you for submitting a pull request! We appreciate the time and effort you have invested in making these changes. Please ensure that you provide enough information to allow others to review your pull request. Upon submission, your pull request will be automatically assigned with reviewers. If you want to learn more about contributing to this project, please visit: https://github.com/lynx-family/lynx-stack/blob/main/CONTRIBUTING.md. --> <!-- The AI summary below will be auto-generated - feel free to replace it with your own. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new static text rendering benchmark test case to measure performance * New npm scripts available for running benchmarks and generating performance profiles * **Chores** * Updated test coverage configuration for improved snapshot directory handling <!-- end of auto-generated comment: release notes by coderabbit.ai --> ## Checklist <!--- Check and mark with an "x" --> - [ ] Tests updated (or not required). - [ ] Documentation updated (or not required). - [ ] Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).
1 parent 96545dd commit c1225ac

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2025 The Lynx Authors. All rights reserved.
2+
// Licensed under the Apache License Version 2.0 that can be found in the
3+
// LICENSE file in the root directory of this source tree.
4+
5+
import { root } from '@lynx-js/react';
6+
7+
import { RunBenchmarkUntilHydrate } from '../../src/RunBenchmarkUntil.js';
8+
9+
runAfterLoadScript(() => {
10+
root.render(
11+
<>
12+
{Array.from(
13+
{ length: 100 },
14+
() => (
15+
<text>
16+
Hello, ReactLynx 🎉!
17+
</text>
18+
),
19+
)}
20+
<RunBenchmarkUntilHydrate />
21+
</>,
22+
);
23+
});

benchmark/react/lynx.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export default defineConfig({
4545
'005-load-script': [
4646
'./cases/005-load-script/index.tsx',
4747
],
48+
'006-static-raw-text': [
49+
'./src/patchProfile.ts',
50+
'./cases/006-static-raw-text/index.tsx',
51+
],
4852
},
4953
},
5054
plugins: [

benchmark/react/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"bench:003-hello-list": "benchx_cli run dist/003-hello-list.lynx.bundle --wait-for-id=stop-benchmark-true",
1111
"bench:004-various-update": "benchx_cli run dist/004-various-update.lynx.bundle --wait-for-id=stop-benchmark-true",
1212
"bench:005-load-script": "benchx_cli run dist/005-load-script.lynx.bundle",
13+
"bench:006-static-raw-text": "benchx_cli run dist/006-static-raw-text.lynx.bundle --wait-for-id=stop-benchmark-true",
1314
"build": "rspeedy build",
1415
"dev": "rspeedy dev",
1516
"perfetto": "pnpm run --sequential --stream --aggregate-output '/^perfetto:.*/'",
@@ -18,6 +19,7 @@
1819
"perfetto:003-hello-list": "benchx_cli -o dist/003-hello-list.ptrace run dist/003-hello-list.lynx.bundle --wait-for-id=stop-benchmark-true",
1920
"perfetto:004-various-update": "benchx_cli -o dist/004-various-update.ptrace run dist/004-various-update.lynx.bundle --wait-for-id=stop-benchmark-true",
2021
"perfetto:005-load-script": "benchx_cli -o dist/005-load-script.ptrace run dist/005-load-script.lynx.bundle",
22+
"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",
2123
"test": "echo 'No tests specified'"
2224
},
2325
"dependencies": {

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default defineConfig({
2424
'website/**',
2525

2626
'packages/react/transform/tests/__swc_snapshots__/**',
27-
'packages/rspeedy/create-rspeedy/template-*/**',
27+
'**/tests/__swc_snapshots__/**',
2828

2929
'.lintstagedrc.mjs',
3030
'eslint.config.js',

0 commit comments

Comments
 (0)