Skip to content

Blink: add a stream version, to share work between rules - #279

Merged
TomasVotruba merged 1 commit into
ecsphp:mainfrom
gnutix:perf/stream-version
Nov 4, 2026
Merged

TomasVotruba merged 1 commit into
ecsphp:mainfrom
gnutix:perf/stream-version

Conversation

@gnutix

@gnutix gnutix commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem: NativeFunctionInvocation, NativeConstantInvocation and GlobalNamespaceImport each build the same symScan. Eight rules render the whole file twice, only to report whether they changed it.

Change: Stream gets a version that every write changes (writing the same value doesn't), and Memo, which caches a value until the version changes. The three rules share one symScan. The eight rules skip the second render when the version didn't change.

Result: these 11 rules on a private 8.8k-file codebase: 5.4 s → 4.0 s of CPU.

Tests: new tests for Version and Memo. Existing tests pass, and the private codebase still has 0 diffs. On 28k files with 18.5k diffs, main and this branch give the same output.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y1vvcRhpVMjWLC4U5j78Xp

Every write to the stream now changes its version. Three rules share one
symbol scan while the file is unchanged, and eight rules skip a second
render when nothing changed. The output is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gnutix
gnutix force-pushed the perf/stream-version branch from bf3921d to 5d497d3 Compare November 4, 2026 17:37
@gnutix gnutix changed the title Blink: a stream version, to share symScan and skip a render per rule Blink: add a stream version, to share work between rules Nov 4, 2026
@TomasVotruba
TomasVotruba merged commit eb00fa0 into ecsphp:main Nov 4, 2026
20 of 21 checks passed
@TomasVotruba

Copy link
Copy Markdown
Member

Thank you 👍 What was the prompt you made this with?

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.

2 participants