Repository navigation
Conversation
A string of 15 bytes or less is kept in the 16-byte SqlString, so clone and drop do no atomic operations. A longer string stays an ArcStr. Equality, order, hash, serde and rkyv are those of the text, so the storage format does not change. Adds the `string_rows` benchmark. Signed-off-by: Song Huang <xiasongh@gmail.com>
Two overlapping loads in place of a copy of variable length. A string of 15 bytes or less is 1.4 to 2.3 times faster to build. Signed-off-by: Song Huang <xiasongh@gmail.com>
Experimental. The `small-string` feature of feldera-sqllib selects the 16-byte inline SqlString. Without it, SqlString is an 8-byte ArcStr, as before. `SET FELDERA_SMALL_STRING = true` makes the SQL compiler enable the feature in the generated Cargo.toml. Signed-off-by: Song Huang <xiasongh@gmail.com>
Contributor
|
Why not have this always-on? |
Member
|
There's a lot of work in Rust on so-called "German strings" along these lines. I just mention that to make sure that you (or Claude) looked at the prior art in the area. |
Contributor
Author
yep, this was inspired by german strings |
Contributor
Author
there's some scenarios where it can be slower. my tests just show that it can be an improvement in some workloads |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in small-string layout for
SqlString. A string of 15 bytes or less is stored inline in a 16-byte value. Clone and drop of an inline string do not touch an atomic reference count. A longer string stays a reference-countedArcStr.small-stringfeature tofeldera-sqllibin the generated pipelineCargo.toml. Cargo unifies features, so every crate of the pipeline uses the sameSqlString.SqlStringis the same 8-byteArcStras onmain.Option<SqlString>stays 16 bytes, because the length byte has niches.memcpycall (micro-benchmark, 0 to 15 bytes: 4.5 to 1.9 ns).When to turn it on: most strings are 15 bytes or less (codes, flags, short IDs), and joins copy them into many rows. With long strings (for example UUID text), each string takes 16 bytes instead of 8, so it can be slower.
Describe Manual Test Plan
Unit tests in
string.rsrun with the feature on and off. The tests below compare the feature off (ddf46b83d4) with the feature on, with the same input. 8 workers.lineorder_flatis byte-identical (5,998,347 rows). The final states of the local QA views are identical.main(1648 vs 1692 ns/row).Checklist
Breaking Changes?
None. The feature is off by default, and the storage format does not change.