Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions quest/m1/ffi-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ census refuses and what moq waits on:
- ✅ One header, `include/<prefix>.h`.
- ✅ One `ffi.toml`, with a `[crates.<package>]` table per other export, and
`--census <dir>` writing `<package>.md` for each.
- Landed in [#76](https://github.com/kixelated/rust2/pull/76). Next, decided with the
maintainer on 2026-10-26: the glue also carries the `[patch]` tables cargo reads
from `.cargo/config.toml` (config has no `[replace]`), with cargo's precedence
between config and manifest and paths relative to the config file. moq-clock is
merging into kio, so its export moves with it and its C names wait until then.
- **Driving**: sessions and origins run a `Driver` polled with a time and a `kio::Waiter`.
Decide between exporting that poll, a generated thread that drives it, or moq-tokio's
runtime helpers.
Expand Down
8 changes: 8 additions & 0 deletions quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ The fork's feature quests folded into the [exporter](/quest/m1/ffi-export.md);

- [Cheaper byte slices](/quest/m2/ts-byte-views.md) - splitting a `&[u8]` stops making a `Uint8Array` view per split
- [Smaller output from MIR](/quest/m2/ts-mir-size.md) - the bench's bundles shrink back to THIR's sizes, coroutine classes first
- [Time Timestamp's checked_add and Ord](/quest/m2/ts-bench-timestamp.md) - the `u128` paths #89 sped up get a Chrome timing
- [Time the minified bundles](/quest/m2/ts-bench-minified.md) - `just ts bench` times what it measures for size, as consumers ship it
- [Drop in the TypeScript translator](/quest/m2/ts-drop.md) - every value that drops in moq-net and kio drops where Rust drops it
- [Async in the TypeScript translator](/quest/m2/ts-async.md) - moq-net's and kio's async code translates with Rust's lazy futures
- [Shared ownership](/quest/m2/ts-shared.md) - `Arc`/`Rc`/`Weak` keep exact counts, and locks and atomics become plain values
- [Copy what a container stores](/quest/m2/ts-store-alias.md) - `push` and other stores of a `Copy` aggregate copy it instead of sharing it
- [str and String methods over char](/quest/m2/ts-str-char.md) - `chars`, `char` patterns, and `String::push` translate, unblocking `ietf/namespace.rs`
- [Share a held-back read across a call](/quest/m2/ts-shared-read.md) - `leading-ones` decode recovers what #83's copy fix cost
- [Output tsc accepts for writes through Result and Poll compares](/quest/m2/ts-tsc-shapes.md) - two shapes whose output fails `tsc` type-check
- [Translate derived == through references and slice index writes](/quest/m2/ts-ref-shapes.md) - two refused shapes #83's tests hit
- [Translate moq-net's model to TypeScript](/quest/m2/ts-model.md) - the driver grows from moq-net's codec to its model, for moq to compare against WASM
- [Waiting: Swift 6.4 in nixpkgs-unstable](/quest/m2/uniffi-swift-arm.md) - the nightly UniFFI fixtures move back to arm
- [Waiting: ubrn reads UniFFI 0.32](/quest/m2/ubrn-release.md) - the binding benchmark's browser runner pins a ubrn release, not an open PR
20 changes: 20 additions & 0 deletions quest/m2/ts-bench-minified.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [XS] Time the minified bundles

## Goal

`just ts bench` times the same minified bundles it measures for size, for every route
and engine, so speed calls judge what consumers ship.

## Plan

Decided with the maintainer on 2026-10-26, from
[#85](https://github.com/kixelated/rust2/pull/85): `ts/bench/main.ts` reports sizes
from `bundle(..., { minify: true })` but serves the pages unminified bundles, so a
minifier's renaming and restructuring never reaches the timings.

- Serve each route's minified bundle, the hand-written and wasm routes included, so
every route is timed the same way.
- Record in the PR the A/A spread and each route's change against the unminified
timings, in Chrome first, then Firefox and Bun.

Public API: none.
21 changes: 21 additions & 0 deletions quest/m2/ts-bench-timestamp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# [XS] Time Timestamp's checked_add and Ord in the TS benchmark

## Goal

`just ts bench` times moq-net's `Timestamp::checked_add` and `Ord`, whose `u128`
cross products the wide runtime now computes in limbs, in Chrome, Firefox and Bun
with the A/A control.

## Plan

Decided with the maintainer on 2026-10-26, from
[#89](https://github.com/kixelated/rust2/pull/89): its Node/Bun microbench put
`checked_add` and `saturating_sub` 20-100x faster, but no bench workload reaches them,
so Chrome never timed them.

- Add the workload beside `time/u128`, drawing its inputs from the wasm32 build as
the other workloads do.
- The remaining 128-bit `bigint` paths (bitwise ops, shifts, `leading_*`, `try_from`)
stay until a consumer reaches them.

Public API: none.
8 changes: 7 additions & 1 deletion quest/m2/ts-mir-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[rust2-ts](/ts/README.md)'s bundles on `just ts bench` are no larger than the THIR
lowering's were, without giving up the speed MIR gained: the codec's at most 30629
bytes minified and 9422 gzipped, and the async handoff's at most 10949 and 3458.
bytes minified and 9422 gzipped, and the async handoff's at most 3458 gzipped.

## Plan

Expand Down Expand Up @@ -33,6 +33,12 @@ Tried and dropped:
in (`level2` into `level1` and on): exact, but it removes the depth the handoff
measures, and moq-net's wrappers await `kio::wait`, not such an `async fn`.

Decided with the maintainer on 2026-10-26, from
[#85](https://github.com/kixelated/rust2/pull/85): the handoff's target is gzipped
only. Its minified gap is the fixture's repeated one-await classes, which only a
shared driver (measured slower or larger) or collapsing the wrappers (which empties
the bench) would close.

Generators and closures stay out: they measured 1.4-5.5x and 1.3-1.8x slower on the
handoff. Coroutine fields stay private.

Expand Down
17 changes: 17 additions & 0 deletions quest/m2/ts-ref-shapes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# [S] Translate derived == through references and slice index writes

## Goal

rust2-ts translates `<&T as PartialEq>::eq`, which a derived `==` on an enum holding
references reaches, and `live[0] = x` on a `&mut [u8]` parameter, proven by
differential tests against native Rust.

## Plan

Found by [#83](https://github.com/kixelated/rust2/pull/83)'s tests on 2026-10-26.
Both are refused with a span today: the first as unsupported, the second as a raw
pointer.

- Report each one's count in moq-net's census before and after.

Public API: the translator's output.
20 changes: 20 additions & 0 deletions quest/m2/ts-shared-read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [XS] Share a held-back read across a call

## Goal

`Decoder::varint`'s `leading-ones` decode on `just ts bench` is back to its speed before
[#83](https://github.com/kixelated/rust2/pull/83) in Chrome, with every differential
test still passing.

## Plan

Decided with the maintainer on 2026-10-26: #83 fixed a silent copy miscompile and
accepted a 2-19% `leading-ones` decode cost in Node and Chromium to do it. The
translator now copies `self.form` before calling `read`, because an earlier pass stops
holding back the read of `self.form` before that call, so the call can't share it.

- Let the held-back read reach the call when nothing between them can change the
source, so `self.form` is shared again without a copy.
- Prove the read is still exact with the argument-aliasing cases #83 added.

Public API: the translator's output.
23 changes: 23 additions & 0 deletions quest/m2/ts-store-alias.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [S] Copy what a container stores

## Goal

Storing a by-value `Copy` aggregate in a container copies it, as Rust does:
`v.push(pair); v.push(pair); v[0].0 ^= 1` leaves `v[1]` and `pair` unchanged in
translated TypeScript. Differential tests against native Rust cover `Vec::push`,
`insert`, `VecDeque::push_back`, map inserts, and `Box::new`.

## Plan

Found by [#86](https://github.com/kixelated/rust2/pull/86) on 2026-10-26, and it
still reproduces after [#83](https://github.com/kixelated/rust2/pull/83)'s typed
copies: 1280 differences against native Rust in its probe. It is a silent miscompile.

- The cause is the share analysis in `ts/src/lower/mir/mod.rs`: it sees a later change
made in place through a local, not through a container element, so it shares the
argument instead of copying it.
- Fix it there, once for every std call that stores a by-value argument, not in each
mapping.
- Measure the codec bench before and after.

Public API: the translator's output.
18 changes: 18 additions & 0 deletions quest/m2/ts-str-char.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# [S] str and String methods over char

## Goal

rust2-ts translates `str::chars`, the `str` methods that take a `char` pattern,
`char::is_ascii_digit`, and `String::push` through `&mut String`, so moq-net's
`ietf/namespace.rs` translates, proven by differential tests against native Rust.

## Plan

Found by [#86](https://github.com/kixelated/rust2/pull/86)'s census on 2026-10-26,
after `char` values themselves translate. `String::push` through `&mut String` is the
one that blocks `ietf/namespace.rs`.

- Cover multi-byte and surrogate-boundary characters in the differential tests.
- Report moq-net's census before and after.

Public API: the translator's output.
17 changes: 17 additions & 0 deletions quest/m2/ts-tsc-shapes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# [S] Output tsc accepts for writes through Result and Poll compares

## Goal

Translated code that `tsc` rejects today type-checks and matches native Rust in
differential tests: writing through `if let Err(e) = &mut res { *e += 1 }`, and
comparing a `Poll` whose state TypeScript can see with `rt.Pending`.

## Plan

Found by [#83](https://github.com/kixelated/rust2/pull/83)'s tests on 2026-10-26.
The first writes the read-only `rt.Result.error`; the second narrows the `Poll` so
the comparison has no overlap. Both fail `tsc`, so they are loud, not silent.

- Fix each in the lowering or the runtime's types, not by casting at the call site.

Public API: the translator's output and `rt`'s types.
20 changes: 20 additions & 0 deletions quest/m2/uniffi-swift-arm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [XS] Waiting: Swift 6.4 in nixpkgs-unstable

## Goal

The nightly `uniffi-fixtures` job runs on `ubuntu-24.04-arm` again, and
`nix develop .#uniffi` evaluates on aarch64-linux. Check: the latest
`nixpkgs-unstable` carries Swift 6.4.0
([NixOS/nixpkgs#574002](https://github.com/NixOS/nixpkgs/pull/574002), merged to
`staging`), and `nix build --dry-run .#devShells.aarch64-linux.uniffi` succeeds
after a bump.

## Plan

Decided with the maintainer on 2026-10-26, from
[#93](https://github.com/kixelated/rust2/pull/93): swiftc 6.3.3 is marked broken on
aarch64-linux in the pinned nixpkgs, where its gold link fails, so the job moved to
x86_64. Then bump the `nixpkgs` input in its own change, move the job back, and
drop the workflow comment. Never allow the broken package.

Public API: none.