Skip to content

Commit 1d5d0f8

Browse files
committed
Add thread-local string interner for ReString
Introduces InternedReString, a wrapper around ReString that deduplicates long strings via a per-thread HashSet. Strings longer than size_of::<String>() are stored as Arc<str> and looked up on construction and during deserialization (serde and bilrost), so repeated values share a single heap allocation. Short strings are stored inline and bypass the interner entirely. The bilrost decode path is optimized with a fast path for contiguous buffers: when chunk() covers the full string, we read directly as &str and query the interner without allocating a temporary buffer.
1 parent e737496 commit 1d5d0f8

File tree

5 files changed

+532
-1
lines changed

5 files changed

+532
-1
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

util/string/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ restate-workspace-hack = { workspace = true }
1919
bilrost = { workspace = true, optional = true }
2020
bytes = { workspace = true, optional = true }
2121
compact_str = { workspace = true, features = ["std"] }
22+
ahash = { workspace = true }
2223
serde = { workspace = true, optional = true }
24+
hashbrown = { workspace = true }
2325

2426
[dev-dependencies]
2527
restate-util-string = {path = ".", default-features = false, features = ["bytes", "bilrost", "serde"]}

0 commit comments

Comments
 (0)