Skip to content

perf(lint): avoid repeated source copies in shared-utils rule - #39

Closed
fengmk2 wants to merge 1 commit into
mainfrom
codex/shared-utils-performance
Closed

fengmk2 wants to merge 1 commit into
mainfrom
codex/shared-utils-performance

Conversation

@fengmk2

@fengmk2 fengmk2 commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

The vinext-utils/prefer-shared-utils rule copies the full source for each comment or string it masks. Large files cause repeated copies and extra garbage collection.

The rule now scans the original source, collects the unchanged sections and replacement spaces, and joins them once. It preserves declaration matching, template handling, and one report per helper per file.

The machine uses an Apple M4 Max, macOS 27.0.1, and Node.js 26.13.0. Both versions check 1,831 files with four threads and OXLINT_TSGOLINT_CHECKER_SCHEDULING=sorted. Only the rule implementation changes between runs.

Each version has one warm-up and five measured runs per configuration. Runs alternate between versions. The table shows median command times.

JS plugins Type-aware linting and type checking Before After Speedup
Both Disabled 7.26 s 1.40 s 5.17×
Only prefer-shared-utils Disabled 7.32 s 1.40 s 5.23×
Both Enabled 10.02 s 4.12 s 2.43×

The two features use the typeAware and typeCheck options, respectively. Both options change together in these measurements. With both JS plugins, type-aware linting, and type checking disabled, the control median is 0.64 seconds.

@fengmk2
fengmk2 force-pushed the codex/shared-utils-performance branch from 4746fa7 to 242223f Compare November 5, 2026 05:39
@fengmk2
fengmk2 changed the base branch from chore/upgrade-vite-plus-1.5.0 to main November 5, 2026 05:39
@fengmk2
fengmk2 force-pushed the codex/shared-utils-performance branch from 242223f to 5e7b0cc Compare November 5, 2026 05:46
@fengmk2 fengmk2 closed this Nov 6, 2026
@fengmk2
fengmk2 deleted the codex/shared-utils-performance branch November 6, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant