Skip to content

Replace path string literals with pre-computed hashes#490

Open
nicked wants to merge 1 commit intouber:masterfrom
nicked:nick/precomputed-path-hashes
Open

Replace path string literals with pre-computed hashes#490
nicked wants to merge 1 commit intouber:masterfrom
nicked:nick/precomputed-path-hashes

Conversation

@nicked
Copy link
Copy Markdown

@nicked nicked commented Apr 21, 2026

The codegen previously emitted full component path strings as literals (e.g. ^->AppComponent->RootComponent->...) for DI provider registration. The strings were only used as dictionary keys in providerFactories[componentPath.hashValue]. In large apps with many components, these unique path strings can add several megabytes to the binary's __cstring section.

This change pre-computes a stable hash of each path string and emits that hash in the codegen instead. The runtime uses the same hash function to look up providers at component creation time.

Swift's String.hashValue is non-deterministic so was replaced by a stable hashing function.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 21, 2026

CLA assistant check
All committers have signed the CLA.

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