mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-03-20 09:01:05 +08:00
# 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.