From 6a6bab359c1993b80e4fc1ff5d2287b05fa098fe Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Mon, 26 Oct 2026 09:35:39 -0700 Subject: [PATCH] chore(quest): typed copies, char and vec!, Firefox bench, narrower bench reruns Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0115AT2ue6x9cT5e5J9SZtCn --- quest/m2/README.md | 3 +++ quest/m2/ts-bench-firefox.md | 16 ++++++++++++++++ quest/m2/ts-char-vec.md | 21 +++++++++++++++++++++ quest/m2/ts-copy.md | 23 +++++++++++++++++++++++ quest/m3/README.md | 1 + quest/m3/bench-rerun.md | 21 +++++++++++++++++++++ 6 files changed, 85 insertions(+) create mode 100644 quest/m2/ts-bench-firefox.md create mode 100644 quest/m2/ts-char-vec.md create mode 100644 quest/m2/ts-copy.md create mode 100644 quest/m3/bench-rerun.md diff --git a/quest/m2/README.md b/quest/m2/README.md index a2d3b0856..606a2325b 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -28,6 +28,9 @@ The fork's feature quests folded into the [exporter](/quest/m1/ffi-export.md); - [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 - [Collection keys and element references](/quest/m2/ts-keys.md) - `Arc` and `Option` keys, borrowed lookups, and `&mut` to a value in a collection translate +- [Copy by type](/quest/m2/ts-copy.md) - copying a `Copy` aggregate shares its references instead of deep-copying them +- [Translate char and vec![x]](/quest/m2/ts-char-vec.md) - `char` values and `vec![x]` translate, unblocking moq-net's refused sites +- [Firefox in the TS benchmark](/quest/m2/ts-bench-firefox.md) - SpiderMonkey joins Chrome, Bun, and Node in `just ts bench` - [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 - [Nightly MSVC and macOS](/quest/m2/uniffi-ci-msvc-macos.md) - the C and C++ fixtures compile nightly with MSVC and Apple Clang, at C++17 and C++20, and without exceptions or RTTI - [Symlinked paths](/quest/m2/uniffi-symlink-path.md) - the fork builds when a consumer reaches it through a symlink, as on macOS's `/var` diff --git a/quest/m2/ts-bench-firefox.md b/quest/m2/ts-bench-firefox.md new file mode 100644 index 000000000..f7222c8b1 --- /dev/null +++ b/quest/m2/ts-bench-firefox.md @@ -0,0 +1,16 @@ +# [S] Firefox in the TS benchmark + +## Goal + +`just ts bench` runs every route in Firefox (SpiderMonkey) alongside Chrome, Bun, and +Node, with the same A/A control, in CI and locally. + +## Plan + +Decided with the maintainer on 2026-10-26: the translator targets browsers, so +browser engines decide speed calls. Chrome (V8) and Bun (JavaScriptCore, as in +Safari) are covered; SpiderMonkey isn't. Node stays as a V8 proxy that's cheap to +run. Drive Firefox through the same harness Chrome uses, and report its numbers in +the bench summary. + +Public API: none. diff --git a/quest/m2/ts-char-vec.md b/quest/m2/ts-char-vec.md new file mode 100644 index 000000000..6bfbbb53e --- /dev/null +++ b/quest/m2/ts-char-vec.md @@ -0,0 +1,21 @@ +# [S] Translate char and vec![x] + +## Goal + +rust2-ts translates `char` values and `vec![x]` on the pinned nightly, proven by +differential tests against native Rust, which unblocks moq-net's 6 refused `char` +switches and 17 refused `vec![x]` sites. + +## Plan + +Decided with the maintainer on 2026-10-26, from +[#78](https://github.com/kixelated/rust2/pull/78)'s census. + +- **`char`:** a number holding the Unicode scalar value, so it switches, compares, + and orders like Rust's. Conversions keep Rust's rules: `as u8` truncates, + `char::from_u32` rejects surrogates and values past `0x10FFFF`, and formatting + writes UTF-8 or UTF-16 as the target needs. +- **`vec![x]`:** lower the nightly's expansion (`from_elem` or the boxed-slice + route), including `vec![x; n]` with `Clone` semantics for each element. + +Public API: the translator's output. diff --git a/quest/m2/ts-copy.md b/quest/m2/ts-copy.md new file mode 100644 index 000000000..ca8fff2ee --- /dev/null +++ b/quest/m2/ts-copy.md @@ -0,0 +1,23 @@ +# [S] Copy by type + +## Goal + +Copying a `Copy` aggregate in translated TypeScript copies its values and shares its +references, as Rust does. Today `rt.copy` deep-copies the aggregate, references +included: copying `(&Cell, u8)` clones the cell, so a write through the copy's +reference changes the clone instead of the original. Differential tests against +native Rust cover tuples, arrays, `Option`, `Result`, and structs holding shared +references to interior-mutable values. + +## Plan + +Decided with the maintainer on 2026-10-26, from a review finding on +[#78](https://github.com/kixelated/rust2/pull/78). The bug predates #78 and is a +silent miscompile, so either fix it or refuse the shapes it can't copy, with a span. + +- Copy by the static type: the lowering knows which fields are references, so it + can emit a shallow copy for those and a value copy for the rest, instead of + one generic `rt.copy`. +- Measure the codec bench before and after; a typed copy should be no slower. + +Public API: the translator's output. diff --git a/quest/m3/README.md b/quest/m3/README.md index 5d16eb5d6..955761c41 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -10,3 +10,4 @@ each a measurement that decides whether its follow-up lands. - [Steadier edit numbers](/quest/m3/bench-edit-noise.md) - moq's edit scenarios compare night to night within a few percent - [Retrial Cranelift on moq's tests](/quest/m3/cranelift-unwind.md) - waits on upstream: moq's tests pass under Cranelift, so its CI can weigh it again - [Relink without rebuilding](/quest/m3/relink.md) - measure upstream's skip of dependency-only rebuilds on moq's edits once it reaches nightly +- [Bench only what changed](/quest/m3/bench-rerun.md) - a push reruns the build benchmark only when it changes a bench input since the last benched head diff --git a/quest/m3/bench-rerun.md b/quest/m3/bench-rerun.md new file mode 100644 index 000000000..e2992267e --- /dev/null +++ b/quest/m3/bench-rerun.md @@ -0,0 +1,21 @@ +# [S] Bench only what changed since the last run + +## Goal + +A push to a PR reruns the build benchmark only when it changes a bench input since +the PR's last benched head. A README, quest, or docs-only push after a benched one +skips every bench job, so it costs no runner time. + +## Plan + +Decided with the maintainer on 2026-10-26, after +[#74](https://github.com/kixelated/rust2/pull/74)'s README-only push reran every +job, about 2 runner-hours. The `Changed` job in `bench.yml` diffs the whole PR +against its base, so once a PR touches `bench/build`, every push reruns everything. + +- Compare against the last head whose bench run succeeded on this PR, when there is + one, and against the base otherwise. Keep the flake-output comparison. +- Keep per-job filtering out: every job shares `run.sh`. +- A failed lookup runs the bench, so it never quietly skips. + +Public API: none.