Repository navigation
Conversation
…native `crates/uniffi` gets the push protocol `crates/wasm` speaks: `attach(host)` with a `notify(state, lo, hi)` per change and timers as host calls, next to the pull API (`send`/`send_json` push, `send_kind`/`send_payload_json` pull). The crate is its own cargo workspace so it builds from a git worktree too. `sandbox/uniffi` is the turbo module ubrn generates from it (config only; the glue, the TS bindings and the xcframework are built by `pnpm ubrn:ios` and ignored). The Expo sandbox depends on it and times TS vs Rust pull vs Rust push per event in Hermes (`rust-bench.tsx`); the findings and the numbers are in TODO.md. Along the way: Expo's tsconfig-paths loader is off (it needs the TypeScript JS API, gone in TS 7) and `babel-preset-expo` is an explicit devDependency (pnpm does not hoist it for the release bundle step). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ARCHITECTURE.md draws the two-engine shape end to end: engines synced by spec, machines with their connectors, the bindings (wasm, uniffi) and the facades that put a Rust machine behind the TS Machine interface, the shared bindings and the targets, and the Rust column above the engine (a connector per machine, a shared bindings crate, one iced target spanning macOS, Windows and Linux). TODO.md records the decision: the TS engine stays the React Native default, Rust-written machines are consumed over wasm and uniffi behind a facade, and lists what the facade needs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The intro says what the Rust side changes: the machine is substrate-agnostic and language-agnostic, with a TS engine and a Rust engine on one spec, and a machine written in Rust reaching TypeScript through wasm behind the same Machine interface. A compact diagram, a pointer to the Rust benchmark, and links to the Rust docs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch was successfully 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.
Stacks on #75 (
rust-core). A spike, not a feature: what does a Rust machine cost on React Native over uniffi? Measured: too slow for a hot path, fine for a UI machine. The decision it led to: the TS engine stays the React Native default, and machines written in Rust (e.g. a dropdown) are consumed as wasm on the web and over uniffi on React Native, behind a facade likefromWasm.TODO.mdcarries the plan;ARCHITECTURE.mdnow has the target diagram, including the Rust render path (connector,crates/bindings, iced).What it adds
crates/uniffispeaks the push protocolcrates/wasmspeaks:attach(host)with onenotify(state, lo, hi)per change and timers as host calls (start_timer/cancel_timer), next to the pull API.send/send_jsonpush;send_kind/send_payload_jsonpull. The crate is its own cargo workspace, so it also builds from a git worktree.sandbox/uniffi: the React Native turbo module uniffi-bindgen-react-native (ubrn 0.31.0-6, matching uniffi 0.31) generates from the crate. Onlypackage.jsonandubrn.config.yamlare source;pnpm ubrn:iosbuilds the Rust for the simulator and generates the C++/TS glue, all ignored. Expo autolinks it into a dev build. No Swift, no Kotlin, no Android.sandbox/native/rust-bench.tsx: the Expo sandbox times TS vs Rust pull vs Rust push per event in Hermes, on screen and in the Metro log.Numbers
Release build, Hermes, iPhone 17 simulator (arm64), median of 3 runs of 50,000 events:
stateIndex())Arcclone, then the call) plus the status object and closures the generated TS allocates per call. Push and pull cost the same; a notify back into JS adds ~0.3 µs.Also in here
app.json: it needs the TypeScript JS API, which TypeScript 7 no longer ships, so Metro would not start on this branch. The workspace packages resolve bymain, so nothing is lost.babel-preset-expois an explicit devDependency of the native sandbox: pnpm does not hoist it, and the Release bundle step could not find it.Not done, on purpose
fromUniffi, the twin offromWasm), no typed payloads, and nostart/stop/fire_timerin push mode. These are the next steps, listed inTODO.md.How to run
🤖 Generated with Claude Code