Skip to content

Identifiers: Refactor + Improve type-safety & performance#4177

Merged
Centril merged 11 commits intomasterfrom
centril/identifier-cleanup
Feb 4, 2026
Merged

Identifiers: Refactor + Improve type-safety & performance#4177
Centril merged 11 commits intomasterfrom
centril/identifier-cleanup

Conversation

@Centril
Copy link
Contributor

@Centril Centril commented Feb 2, 2026

Description of Changes

The goal of this PR is to:

  • Make it easy to switch our backing implementation of identifiers, as seen in the commit changing to LeanString.
  • Improve type safety of our identifiers by having every identifier start with RawIdentifier and then Identifier is just a wrapper with validation on construction. TableName and ReducerName are then just wrappers around Identifier.
  • Reduce allocation in InstanceEnv by using the now clone-on-write O(1) + SSO optimized Identifier.
  • Reduce allocations in the query engine as a consequence of improving RawIdentifier and Identifier.
  • Have &'static str strings be further optimized by avoiding to allocate even for long ones. This is supported by impl From<&'static str> for RawIdentifier as well as switching to LeanString.

The PR results in a roughly 2k TPS improvement over master for WASM + hash indices. This should also help V8, as this is VM-agnostic.

API and ABI breaking changes

None

Expected complexity level and risk

3? Mostly just small changes in many places, but in a sea of small changes, mistakes can happen.

Testing

Covered by existing tests.

@Centril
Copy link
Contributor Author

Centril commented Feb 2, 2026

Next step after this PR and once websocket 2.0 has been merged is to also use the identifier types in the WS format to further reduce allocation.

@Centril Centril requested a review from gefjon February 2, 2026 16:22
Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in my code-owned files LGTM

@Centril Centril force-pushed the centril/identifier-cleanup branch 2 times, most recently from f860bee to 9d28445 Compare February 4, 2026 15:51
@Centril Centril force-pushed the centril/identifier-cleanup branch from 9d28445 to ab36963 Compare February 4, 2026 15:52
@Centril Centril added this pull request to the merge queue Feb 4, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 4, 2026
@Centril Centril added this pull request to the merge queue Feb 4, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 4, 2026
@Centril Centril added this pull request to the merge queue Feb 4, 2026
Merged via the queue into master with commit ae15508 Feb 4, 2026
28 of 29 checks passed
@Centril Centril deleted the centril/identifier-cleanup branch February 4, 2026 21:48
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.

3 participants