Cross homogeneous arrays typed instead of as JSON#74
Merged
Conversation
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.
Summary
Takes the last high-frequency data off the JSON bridge path. After #73 only array-valued props still crossed as JSON text; now every homogeneous array (all elements one scalar kind) crosses typed too. The only remaining JSON is the two nested/heterogeneous props — alert
buttonsand NavigationStacksearches— which have no natural single JNI type.Encoding. An array value rides the existing per-value slot: a new array-kind tag marks the element type, and the
bitsslot packs(offset << 32 | count)into one of two per-node pools — a sharedArray<String>and a sharedLongArray(numbers bit-cast in, matching the scalar scheme). The bridge constructor gains exactly two parameters (stringPool,longPool); the same two pools serve both props and modifier args, sotraits(an accessibility modifier arg) converts along with the node props. Classification is automatic in the materializer — an array of uniform scalar kind routes to a pool, anything nested or mixed falls back to thekindJSONliteral.No reader churn. The Kotlin constructor rebuilds a
JsonArrayofJsonPrimitives from the pools, soViewNode's in-memory model staysJsonObject/JsonArrayand everyRender.ktarray read is untouched — but noJson.parseToJsonElementruns for homogeneous arrays. Converted:keys(List/Lazy rows — the large, per-update one),titles,detents,traits, gradientcolors.Also drops the now-unused
Materializer.jsonObjectLiteral(dead since modifier args went typed in #73).Testing
swift build --target ComposeUIand Kotlin android/desktop compiles pass.keys), confirmation dialog (nestedbuttons— still JSON, renders all actions and registers the choice), plus button/toggle/nav all correct.