Repository navigation
Make InlineStrings have the same byte order as C-strings - #82
Closed
KristofferC wants to merge 1 commit into
Closed
KristofferC wants to merge 1 commit into
KristofferC wants to merge 1 commit into
Conversation
KristofferC
force-pushed
the
kc/c_compat
branch
from
September 29, 2025 11:42
0a0fbbb to
6b837b3
Compare
InlineStrings have the same byte order as C-strings
KristofferC
force-pushed
the
kc/c_compat
branch
from
September 29, 2025 11:43
6b837b3 to
9c6f48f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #82 +/- ##
==========================================
+ Coverage 93.23% 93.48% +0.24%
==========================================
Files 3 3
Lines 636 645 +9
==========================================
+ Hits 593 603 +10
+ Misses 43 42 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…nversion to a pointer to pass into C-functions
Member
|
Sorry for the slowness here; yes, I'd like to do this. I'm worried about breaking the serialized string case and not being able to read them back unless we do a major version bump? or maybe we provide a best effort compat shim to try and figure out which direction a serialized string should be read as? I think that could probably be 95%+ accurate, but not sure if that would get us in trouble or not. |
4 tasks done
quinnj
added a commit
that referenced
this pull request
Sep 4, 2026
…rt (#94) * InlineStrings 2.0: C-compatible layout, safe codeunits, Base radix sort Store codeunits in String order with a trailing capacity byte that doubles as the NUL terminator (from #82), so inline strings can be passed straight to C via `Ref`. Rework every operation around the new layout, with a byte tuple for random access on the wide types. Also: - `write`/`print` write codeunits like `String`; Serialization via extension - `codeunits` returns a non-Dense vector and `pointer` throws (#90) - Base `UIntMappable` hooks replace the custom radix sort (#64 defalg) - resolve all Aqua ambiguities and run Aqua in CI (#64) - fix matrix alignment (#89), `isascii` tail bytes, `reverse` of 2/3-byte chars, mixed `String`/inline `cmp`, `isvalid` out of range, buffer constructor bounds, non-UInt8 code unit sources (from #92) - `map`/`filter`/`uppercase`/`lowercase` keep the inline type (#5) - minimum Julia 1.10, Parsers as a weak dependency Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Test the Arrow extension through ArrowTypes; move Arrow.jl and TimeZones.jl to the integration workflow Arrow.jl depends on TimeZones.jl, which pins InlineStrings 1, so a 2.0 test environment resolves TimeZones 1.5.9 whose build step fails on Julia 1.12. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Drop arrow-julia from the integration matrix until TimeZones.jl bumps its InlineStrings compat Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * Compute the first UTF-8 byte directly; Base.first_utf8_byte is gone on Julia 1.13 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(core): harden v2 string operations Fix overflow-safe buffer bounds, single-pass map fallback, cross-encoding chop operations, collection widening, and search index validation. Speed up wide slicing, long-needle searches, and empty-string repetition. Add focused regressions and a migration-only invalidation budget. --------- Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Member
|
Superseded by #94, which is now merged for 2.0. Thanks @KristofferC! |
Member
Author
|
🎉 |
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.
The point is that on master we have:
Instead, with this PR we store the capacity minus the length as the last byte (and not the length itself) leading to:
This means that in the case of the inline string being at full capacity the last byte double dips as a null terminator and showing that there is no capacity left (another way of saying that the length of the string is 3).