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
1 change: 1 addition & 0 deletions quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ are folded into the [exporter's](/quest/m1/ffi-export.md). The

- [Waiting: publish the UniFFI fork](/quest/m1/uniffi-release.md) - the fork publishes to crates.io under `rust2-*` names, once the maintainer decides it should
- [Exporter](/quest/m1/ffi-export.md) - moq's bindings exported from its crates' `pub` API, replacing the fork
- [Export instances of generic types](/quest/m1/ffi-generic.md) - a generic type exports at the instances the config names
- [Land main through quest land](/quest/m1/land.md) - every queued PR lands as one tested batch through the shared gate
- [Bump quest to quest land](/quest/m1/land-bump.md) - condition: kixelated/quest ships `quest land`; then bump the flake input
20 changes: 20 additions & 0 deletions quest/m1/ffi-generic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [M] Export instances of generic types

## Goal

The [exporter](/ffi/README.md) exports a generic type at the instances the config names,
such as `catalog::Producer<hang::Extra>`, so moq-ffi's media API that uses each at one
type exports from moq-mux and hang.

## Plan

Found by [#94](https://github.com/kixelated/rust2/pull/94) on 2026-10-27: refused generic
types block about 67 of moq-ffi's partly covered items, mostly in moq-mux
(`catalog::Producer<T>`, `container::Consumer<T>`). moq-ffi uses each at one type.

- Name each instance in [the config](/ffi/moq/ffi.toml), with the C name it exports
under, and refuse with a span any signature that reaches a generic type at an instance
the config does not name.
- Report each export's census and the coverage of moq-ffi's API before and after.

Public API: the exporter's config and the C names it emits.
6 changes: 5 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ 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
- [An A/A control that measures noise](/quest/m2/ts-bench-aa.md) - `just ts bench`'s A/A measures only noise, in every engine
- [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
- [Share a held-back read across a call](/quest/m2/ts-shared-read.md) - `leading-ones` decode recovers what #83's copy fix cost
- [Share what the crate never changes in place](/quest/m2/ts-shared-read.md) - copies of `Copy` aggregates no one writes into in place go away, recovering #83's decode 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
- [Default comparison methods](/quest/m2/ts-cmp-defaults.md) - inherited `ne`, `lt`, `le`, `gt`, `ge` and `[u8]` equality translate
- [Copy-on-write strings](/quest/m2/ts-cow-str.md) - `Cow<str>` translates, finishing `ietf/namespace.rs`
- [str slicing and &str patterns](/quest/m2/ts-str-slice.md) - `&s[a..b]` and `&str` patterns translate, so `rfind`'s offsets are usable
- [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
23 changes: 23 additions & 0 deletions quest/m2/ts-bench-aa.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [S] An A/A control that measures noise

## Goal

`just ts bench`'s `A/A` route times the same code as `translated` with nothing else
different, so its spread is the run's noise on every engine, Chrome, Firefox, and Bun.

## Plan

Found by [#87](https://github.com/kixelated/rust2/pull/87) and
[#97](https://github.com/kixelated/rust2/pull/97) on 2026-10-27:

- In JavaScriptCore, the `A/A` bundle and a route's bundle with identical text appear
to share type profiles, so a call site polymorphic in one is polymorphic in both. A
route that differs from `A/A` in text is then not directly comparable with it.
- In Firefox, the handoff's `A/A` runs 6-13% faster than `translated` on main, because
`translated` shares its module with `spawned` and `A/A` does not.

Give every route the same module layout and run each in its own process or realm, so
neither shares state with another. Show the `A/A` spread before and after on each
engine.

Public API: none.
23 changes: 23 additions & 0 deletions quest/m2/ts-cmp-defaults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [S] Default comparison methods

## Goal

rust2-ts translates the default `ne`, `lt`, `le`, `gt`, and `ge` that a crate's own
`PartialEq` and `PartialOrd` impls inherit, and `<[u8] as PartialEq>::eq`, so `a != b`
and `a < b` on derived types translate, proven by differential tests against native
Rust.

## Plan

Found by [#98](https://github.com/kixelated/rust2/pull/98) on 2026-10-27: comparisons
through references now reach the referent's impl, which still refuses an inherited
method. moq-net's census refuses about 60 `ne` calls this way, `path::Path`'s among
them.

- Lower `ne` as `!eq` and the ordering methods from `partial_cmp`, as std's defaults do,
so a `partial_cmp` returning `None` makes all four false.
- Cover a hand-written `partial_cmp` that returns `None`, and a type whose `eq` and
`partial_cmp` disagree, in the differential tests.
- Report moq-net's census before and after.

Public API: the translator's output.
19 changes: 19 additions & 0 deletions quest/m2/ts-cow-str.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# [M] Copy-on-write strings

## Goal

rust2-ts translates `Cow<str>`, so moq-net's `ietf/namespace.rs` translates with no
refusals, proven by differential tests against native Rust.

## Plan

Found by [#96](https://github.com/kixelated/rust2/pull/96) on 2026-10-27: after `str`'s
char methods translate, `<Cow<str> as From<&str>>::from` is `namespace.rs`'s last
refusal, and `Cow<str>` accounts for 139 of moq-net's.

- Choose the representation with the maintainer: a plain JS string, since `str` is
immutable in the output, or a tagged value that keeps `Cow::Borrowed` and
`Cow::Owned` apart for `matches!` and `is_borrowed`.
- Report moq-net's census before and after.

Public API: the translator's output.
33 changes: 22 additions & 11 deletions quest/m2/ts-shared-read.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
# [XS] Share a held-back read across a call
# [S] Share what the crate never changes in place

## 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.
rust2-ts shares a `Copy` aggregate, where it copies one today, when nothing in the crate
writes into a value of that type in place. `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, and every differential
test still passes.

## 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.
Decided with the maintainer on 2026-10-27, replacing the narrower fix for
`self.form`'s copy that this quest held before:
[#83](https://github.com/kixelated/rust2/pull/83) and
[#99](https://github.com/kixelated/rust2/pull/99) copy a `Copy` aggregate before a call
can share it (`self.form` before `read`, `copy$Form` in `Decoder::new` and
`Encoder::new`, and map keys). A copy is only observable if something writes into a
shared value in place: a field or element assignment through it, or a `&mut` to its
inside. A type the crate never writes that way can be shared freely.

- 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.
- Find, per crate, each `Copy` aggregate type that some place writes into in place, and
let `copy_fn`'s callers skip the copy for every other type.
- Keep the analysis whole-crate and fail closed: a write the analysis can't see, such as
through a generic, counts as a write.
- Prove it with #83's argument-aliasing cases and #99's store cases, plus a new case
where the only in-place write is in another module or behind a generic.
- Report the copies removed in moq-net's output, and the Chrome codec bench before and
after.

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

## Goal

rust2-ts translates `&s[a..b]` on a `str` and the `str` methods that take a `&str`
pattern, so moq-net's `path/mod.rs`, `discovery.rs`, and `lite/compress.rs` translate,
proven by differential tests against native Rust.

## Plan

Found by [#96](https://github.com/kixelated/rust2/pull/96) on 2026-10-27, which
translated `char` patterns and returns UTF-8 byte offsets from `rfind` and
`match_indices`. Slicing is what lets those offsets be used.

- Slice by UTF-8 byte offsets and panic, as std does, on a boundary inside a char.
- An empty `&str` pattern matches between every char in `split`, `trim_*`, and
`match_indices`; cover it and multi-byte patterns in the differential tests.
- Report moq-net's census before and after.

Public API: the translator's output.