Files
Mazdak Farrokhzad 5e0c0f7147 execute_plan: don't build temporary vec of rows (#2918)
# Description of Changes

Avoid building a temporary `Vec` in `execute_plan` by exposing a
list-building interface instead.

- The old `fn encode_list` is rewritten in terms of this list-building
interface.
- The `BsatnRowList` and `BsatnRowListBuilder` types are split into two
entirely separate types. The latter now tries to recognize the case
where there isn't a known static layout, but where the BSATN lengths
happen to be the same for all rows anyways. In those cases, the
allocation of `RowSizeHint::RowOffsets` is avoided in favor of just
storing the found length in bytes. This is in particular useful for
small table updates as statistically, the fewer rows, the more chance of
the lengths being all equal. In the case of a single row, the chance is
notably 100%. It is also good for the case of when we don't have
`RelValue::Row` or `Row::Ptr` but where the underlying table that
actually has a static layout.

In the future, we might want to avoid these lists in incremental as
well.

# Benchmarks

Benchmark numbers vs. master using `cargo bench --bench subscription --
--baseline subs` on i7-7700K, 64GB RAM:
```
footprint-scan          time:   [28.731 ms 28.924 ms 29.171 ms]
                        change: [-49.728% -49.006% -48.388%] (p = 0.00 < 0.05)
                        Performance has improved.
```

Performance goes from roughly 56.721 ms to 28.795 ms.

# API and ABI breaking changes

None

# Expected complexity level and risk

2, fairly local change to just subscriptions.

# Testing

Covered by existing tests.
2025-07-30 22:19:57 +00:00

34 lines
898 B
TOML

[package]
name = "spacetimedb-client-api-messages"
version.workspace = true
edition.workspace = true
license-file = "LICENSE"
description = "Types for the SpacetimeDB client API messages"
rust-version.workspace = true
[dependencies]
spacetimedb-lib = { workspace = true, features = ["serde"] }
spacetimedb-primitives.workspace = true
spacetimedb-sats = { workspace = true, features = ["bytestring"] }
bytes.workspace = true
bytestring.workspace = true
chrono = { workspace = true, features = ["serde"] }
enum-as-inner.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
serde_with.workspace = true
smallvec.workspace = true
strum.workspace = true
thiserror.workspace = true
derive_more.workspace = true
[dev-dependencies]
hex.workspace = true
itertools.workspace = true
proptest.workspace = true
serde_json.workspace = true
[lints]
workspace = true