plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


c9ae7c0 — Peter John 2026-11-16T20:54:33+05:30
plan: U4d-g from the perf survey
docs/plans/2026-11-13-no-globals-tests-ports.md CHANGED
@@ -52,5 +52,9 @@ Decisions (user's answers):
52
52
  - **U4a typed closures:** a closure struct per signature called with `call_ref` (backlog: `anyref`, two casts and an indirect call per call, two objects per closure); constructor shorthand `OnFrame(Tick)` for a variant passed as a function.
53
53
  - **U4b paint without the list:** `view()`'s list painted as it is built, no per-frame `List<View>` and fewer trait calls; the declarative paint's +5% and T7's +2% back.
54
54
  - **U4c closures always inlined + in-place misses** (user, 2026-11-16: "Yes please do that rather", the size rule instead of an `inline` keyword): closure_spec's program-wide 8-copy cap becomes a size rule: every literal closure passed to a small known callee is specialised, the cap kept only for big callees. Then the in-place misses: backlog's 36 of 56 (a value rebound by a pattern, receiver read again after a method call, shared value, field passed on, argument from inside a closure); the Elm `update` regression.
55
- - **U4d the backlog's other runtime perf items:** a value struct in an enum payload boxed twice; statics slower than free functions; the smaller codegen items (`br_on_cast`, inliner on `unbox.*`, empty supertypes, purity of closure-taking functions); `Map` reuse alongside sharing. Compile-time items stay with the modular checker in the backlog.
55
+ - Survey 2026-11-16 (release, wasmtime 47, instructions retired): GC is 0-3% (null collector no faster than the default copying one; DRC 8-18x slower), Perceus RC not worth a new backend; in-place reuse is ~5% of Orbit update. User: "Ok do it please" to the ranked list:
56
+ - **U4d std plumbing + strings + sort:** a fast path in std/game delivery for a tick with no events and no `then` (OnFrame/OnHeld called directly, no `Option`/list per subscription; `Subs.picked`, `actAll`/`actIn`, `Trail`/`Folded` are ~40% of Orbit update), held keys as a bitset; literal string pieces in globals and one exact-size allocation per interpolation (`Array<Byte>.resize`/`Str.concat`/`toStr` ~5% of Orbit paint); std `sortBy(key)` and Clockwork's `crowd` sorting on a cached key (trig 29% of Clockwork update, -9% measured). Remove the backlog's out-of-date "statics slower" and "empty supertypes" entries.
57
+ - **U4e a Plum inliner** for small functions that can't trap (no `crash`, checked `at`, division): `inlineLeaves` only takes <=20-byte bodies with no locals; wasmtime's inlining bound the gain at 20-25% of update and paint; keep crash traces' names.
58
+ - **U4f `Nil`/`None` as null** and `br_on_cast` for matches (6 ref.test/ref.cast per element in `mapCells`; no `Some` allocation for an `Option` of a reference).
59
+ - **U4g view lists fused into the paint walk or scalar-replaced** (~55 cells per Orbit frame, `__upcastOnto*` ~4%, an actor's one-item `[Sprite]` 14% of scale paint).
56
60
  - **U5 field layout** (user, 2026-11-16: the grouped form, "With commas after all fields" "except the last one"): `struct PlayingScreen[ScreenSlice<PlayAction>](` / ` dice: Dice, ticks: Int, clock: Float,` / ` score: Int, best: Int, lives: Int, over: Bool,` / ` ship: Ship, orbs: List<Orb>, mines: List<Mine>, rings: List<Ring>,` / ` assets: Assets` / `) =`. This already parses (no grammar change); the formatter keeps the user's line grouping, and games and std types with many fields move to grouped lines; docs show the form. Starts when U4a or U4b finishes.