plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
8b93d56
— Peter John
2026-11-11T19:19:09+05:30
docs/benchmarks: master 20ae0ea0 against simpler-language f6834793
- benchmarks/master_vs_simpler/master/array.plum +2 -10
- benchmarks/master_vs_simpler/master/fib.plum +1 -9
- benchmarks/master_vs_simpler/master/loop.plum +1 -9
- benchmarks/master_vs_simpler/master/map.plum +3 -11
- benchmarks/master_vs_simpler/master/particles.plum +2 -6
- benchmarks/master_vs_simpler/master/str.plum +1 -9
- benchmarks/master_vs_simpler/master/trig.plum +1 -8
- benchmarks/master_vs_simpler/run.py +70 -33
- docs/benchmarks/2026-11-11-master-20ae0ea0-vs-simpler-language.md +168 -0
benchmarks/master_vs_simpler/master/array.plum
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import std/Int
|
|
2
|
-
import std/Float
|
|
3
|
-
import std/Str
|
|
4
|
-
import std/Bool
|
|
5
|
-
import std/Option
|
|
6
|
-
import std/Io
|
|
7
|
-
import std/
|
|
1
|
+
import std/{Float, Int, Io, List, Str}
|
|
8
|
-
import std/collections/Map
|
|
9
|
-
import std/math/math
|
|
10
2
|
|
|
11
3
|
fun once(n: Int) -> Int
|
|
12
|
-
xs := List
|
|
4
|
+
xs := List<Int>()
|
|
13
5
|
for i := range n
|
|
14
6
|
xs.push(i * 3 % 1001)
|
|
15
7
|
s := 0
|
benchmarks/master_vs_simpler/master/fib.plum
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import std/Int
|
|
2
|
-
import std/Float
|
|
3
|
-
import std/Str
|
|
4
|
-
import std/Bool
|
|
5
|
-
import std/Option
|
|
6
|
-
import std/Io
|
|
7
|
-
import std/
|
|
1
|
+
import std/{Float, Int, Io, Str}
|
|
8
|
-
import std/collections/Map
|
|
9
|
-
import std/math/math
|
|
10
2
|
|
|
11
3
|
fun fib(n: Int) -> Int
|
|
12
4
|
if n < 2
|
benchmarks/master_vs_simpler/master/loop.plum
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import std/Int
|
|
2
|
-
import std/Float
|
|
3
|
-
import std/Str
|
|
4
|
-
import std/Bool
|
|
5
|
-
import std/Option
|
|
6
|
-
import std/Io
|
|
7
|
-
import std/
|
|
1
|
+
import std/{Float, Int, Io, Str}
|
|
8
|
-
import std/collections/Map
|
|
9
|
-
import std/math/math
|
|
10
2
|
|
|
11
3
|
fun work(n: Int) -> Int
|
|
12
4
|
acc := 0
|
benchmarks/master_vs_simpler/master/map.plum
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import std/Int
|
|
2
|
-
import std/Float
|
|
3
|
-
import std/Str
|
|
4
|
-
import std/Bool
|
|
5
|
-
import std/Option
|
|
6
|
-
import std/Io
|
|
7
|
-
import std/collections/List
|
|
8
|
-
import std/
|
|
1
|
+
import std/{Float, Int, Io, Map, Str}
|
|
9
|
-
import std/math/math
|
|
10
2
|
|
|
11
3
|
fun once(n: Int) -> Int
|
|
12
|
-
m
|
|
4
|
+
m: Map<Int, Int> := Map.empty()
|
|
13
5
|
for i := range n
|
|
14
6
|
m.set(i * 7919 % 1000003, i)
|
|
15
7
|
s := 0
|
|
16
8
|
for i := range n
|
|
17
|
-
s = s + m.get(i * 7919 % 1000003)
|
|
9
|
+
s = s + {m.get(i * 7919 % 1000003) ?: 0} % 13
|
|
18
10
|
return s + m.length()
|
|
19
11
|
|
|
20
12
|
fun main(io: Io)
|
benchmarks/master_vs_simpler/master/particles.plum
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import std/Int
|
|
2
|
-
import std/Float
|
|
3
|
-
import std/Str
|
|
4
|
-
import std/Io
|
|
5
|
-
import std/
|
|
1
|
+
import std/{Float, Int, Io, List, Str}
|
|
6
2
|
|
|
7
3
|
struct P(x: Float, y: Float, vx: Float, vy: Float) =
|
|
8
4
|
fun move(&self)
|
|
@@ -16,7 +12,7 @@ struct P(x: Float, y: Float, vx: Float, vy: Float) =
|
|
|
16
12
|
self.y = ny
|
|
17
13
|
|
|
18
14
|
fun main(io: Io)
|
|
19
|
-
ps := List
|
|
15
|
+
ps := List<P>()
|
|
20
16
|
for i := range 1000
|
|
21
17
|
ps.push(P(x: Float(i % 200), y: Float(i * 7 % 200), vx: Float(i % 5) - 2.0, vy: Float(i % 7) - 3.0))
|
|
22
18
|
t0 := io.nowMicros()
|
benchmarks/master_vs_simpler/master/str.plum
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import std/Int
|
|
2
|
-
import std/Float
|
|
3
|
-
import std/Str
|
|
4
|
-
import std/Bool
|
|
5
|
-
import std/Option
|
|
6
|
-
import std/Io
|
|
7
|
-
import std/
|
|
1
|
+
import std/{Float, Int, Io, Str}
|
|
8
|
-
import std/collections/Map
|
|
9
|
-
import std/math/math
|
|
10
2
|
|
|
11
3
|
fun main(io: Io)
|
|
12
4
|
t0 := io.nowMicros()
|
benchmarks/master_vs_simpler/master/trig.plum
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import std/Int
|
|
2
|
-
import std/Float
|
|
3
|
-
import std/Str
|
|
4
|
-
import std/Bool
|
|
5
|
-
import std/Option
|
|
6
|
-
import std/Io
|
|
7
|
-
import std/
|
|
1
|
+
import std/{Float, Int, Io, Str}
|
|
8
|
-
import std/collections/Map
|
|
9
2
|
import std/math/math
|
|
10
3
|
|
|
11
4
|
fun main(io: Io)
|
benchmarks/master_vs_simpler/run.py
CHANGED
|
@@ -8,7 +8,7 @@ usage: python3 benchmarks/master_vs_simpler/run.py [--plum PATH] [--runs 5] [--o
|
|
|
8
8
|
|
|
9
9
|
Run from the root of a simpler-language checkout; `--plum` defaults to target/release/plum.
|
|
10
10
|
By default only the branch runs: its default build, --no-fbip and --no-fusion. With
|
|
11
|
-
`--master DIR` (a checkout of master,
|
|
11
|
+
`--master DIR` (a checkout of master, 20ae0ea0 or later, with its compiler built;
|
|
12
12
|
`--master-plum` defaults to DIR/target/release/plum) master runs too and the tables compare
|
|
13
13
|
the two. Each compiler compiles with its own std: master's programs from DIR, the branch's
|
|
14
14
|
from here.
|
|
@@ -20,7 +20,12 @@ data and print the same checksum. The two games are drivers written around each
|
|
|
20
20
|
own game (master's examples/games/orbitrunner and balloonpop, the branch's
|
|
21
21
|
examples/games/orb_run and kids/balloon_pop): this script copies the game without its
|
|
22
22
|
`main` and tests and appends a headless `main` that steps it a fixed number of ticks with
|
|
23
|
-
inputs that are a function of the seed and tick only.
|
|
23
|
+
inputs that are a function of the seed and tick only. On master (20ae0ea0 on) a game is a
|
|
24
|
+
folder; the whole folder is copied into `--out` and the driver replaces `main` in the copy
|
|
25
|
+
of its entry file (OrbitRunner.plum, BalloonPop.plum), so the game's other modules are
|
|
26
|
+
master's own. Master's micro ports are written for 20ae0ea0's syntax (`<>` generics, `T?`
|
|
27
|
+
and `?:`, grouped imports, no unused import); `cons` and `cons_rec` need master's
|
|
28
|
+
`LinkedList`, removed in ed6fec37, and no longer build there. The branch's Orb Run is given
|
|
24
29
|
master's restart rule (`ORB_BRANCH_AGAIN`), so the two play the same games; it is given it
|
|
25
30
|
without `--master` too, so the checksums stay comparable from run to run (at the default
|
|
26
31
|
ticks Orb Run prints checksum 871028980, Balloon Pop checksum 234038249 with 3975 pops).
|
|
@@ -37,6 +42,7 @@ import argparse
|
|
|
37
42
|
import json
|
|
38
43
|
import os
|
|
39
44
|
import re
|
|
45
|
+
import shutil
|
|
40
46
|
import statistics
|
|
41
47
|
import subprocess
|
|
42
48
|
import sys
|
|
@@ -68,8 +74,8 @@ fun steerX(seed: Int, t: Int) -> Float
|
|
|
68
74
|
fun steerY(seed: Int, t: Int) -> Float
|
|
69
75
|
return Float({{seed * 13 + t / 13} * 40503 % 1000033} % 3 - 1)
|
|
70
76
|
|
|
71
|
-
fun heldAt(seed: Int, t: Int) -> List
|
|
77
|
+
fun heldAt(seed: Int, t: Int) -> List<Int>
|
|
72
|
-
keys := List
|
|
78
|
+
keys := List<Int>()
|
|
73
79
|
if steerX(seed, t) < 0.0
|
|
74
80
|
keys.push(Key.Left)
|
|
75
81
|
if steerX(seed, t) > 0.0
|
|
@@ -82,10 +88,10 @@ fun heldAt(seed: Int, t: Int) -> List[Int]
|
|
|
82
88
|
|
|
83
89
|
fun inputAt(seed: Int, t: Int, over: Bool) -> Input
|
|
84
90
|
now := heldAt(seed, t)
|
|
85
|
-
before := List
|
|
91
|
+
before := List<Int>()
|
|
86
92
|
if t > 0
|
|
87
93
|
before = heldAt(seed, t - 1)
|
|
88
|
-
events := List
|
|
94
|
+
events := List<InputEvent>()
|
|
89
95
|
px := Float({t * 37} % 800)
|
|
90
96
|
py := Float({t * 53} % 600)
|
|
91
97
|
events.push(PointerMove(x: px, y: py))
|
|
@@ -106,17 +112,18 @@ fun main(io: Io)
|
|
|
106
112
|
scores := 0
|
|
107
113
|
mines := 0
|
|
108
114
|
for seed := range SEEDS
|
|
109
|
-
|
|
115
|
+
run := RunState.create()
|
|
116
|
+
play := PlayingScreen(rng: Random.seeded(seed), sheet: Texture.none(), run: run)
|
|
117
|
+
g := Game(screens: [play], state: run)
|
|
110
118
|
wasOver := false
|
|
111
119
|
for t := range TICKS
|
|
112
|
-
g.
|
|
120
|
+
g.update(io, inputAt(seed, t, run.over), 1.0 / 60.0)
|
|
113
|
-
r := g.world.run
|
|
114
|
-
if
|
|
121
|
+
if run.over && !wasOver
|
|
115
122
|
overs = overs + 1
|
|
116
|
-
scores = scores +
|
|
123
|
+
scores = scores + run.score
|
|
117
|
-
wasOver =
|
|
124
|
+
wasOver = run.over
|
|
118
|
-
check = {check * 31 +
|
|
125
|
+
check = {check * 31 + run.score + run.lives} % 1000000007
|
|
119
|
-
mines = mines +
|
|
126
|
+
mines = mines + play.mines.length()
|
|
120
127
|
t1 := io.nowMicros()
|
|
121
128
|
io.printLn("ms {Float(t1 - t0) / 1000.0} checksum {check} overs {overs} scoreAtOver {scores} minesAtEnd {mines}")
|
|
122
129
|
'''
|
|
@@ -193,14 +200,15 @@ fun main(io: Io)
|
|
|
193
200
|
check := 0
|
|
194
201
|
pops := 0
|
|
195
202
|
for seed := range SEEDS
|
|
203
|
+
field := PlaygroundScreen.seeded(seed, PopState.create())
|
|
196
|
-
g :=
|
|
204
|
+
g := Game(screens: [field], state: field.run)
|
|
197
205
|
for t := range TICKS
|
|
198
|
-
events := List
|
|
206
|
+
events := List<InputEvent>()
|
|
199
207
|
events.push(PointerDown(x: Float({t * 97} % 800), y: Float({t * 61} % 600)))
|
|
200
208
|
inp := Input(held: Held.none(), events: events, pos: Vec2(x: 0.0, y: 0.0), wheel: 0.0)
|
|
201
|
-
g.
|
|
209
|
+
g.update(io, inp.sized(800.0, 600.0), 1.0 / 60.0)
|
|
202
|
-
check = {check * 31 +
|
|
210
|
+
check = {check * 31 + field.run.pops} % 1000000007
|
|
203
|
-
pops = pops +
|
|
211
|
+
pops = pops + field.run.pops
|
|
204
212
|
t1 := io.nowMicros()
|
|
205
213
|
io.printLn("ms {Float(t1 - t0) / 1000.0} checksum {check} pops {pops}")
|
|
206
214
|
'''
|
|
@@ -230,28 +238,57 @@ fun main(io: Io) =
|
|
|
230
238
|
'''
|
|
231
239
|
|
|
232
240
|
|
|
241
|
+
def master_game(master, out, name, folder, entry, sig, drv, imports):
|
|
242
|
+
"""Master's game as a folder (20ae0ea0 on): copies `folder` to `out/<name>_master/`,
|
|
243
|
+
strips `main` and the tests from the copy of `entry` and appends the driver `drv`
|
|
244
|
+
there, with `imports` (paths, merged into the file's import groups) added for what the driver names and the game file doesn't
|
|
245
|
+
import (an unused import is an error on master, so only those). The other modules of
|
|
246
|
+
the game are master's own, unchanged. Returns the driver's path."""
|
|
247
|
+
dst = f"{out}/{name}_master"
|
|
248
|
+
shutil.rmtree(dst, ignore_errors=True)
|
|
249
|
+
shutil.copytree(master + folder, dst)
|
|
250
|
+
path = f"{dst}/{entry}"
|
|
251
|
+
game = strip_main(path, sig)
|
|
252
|
+
lines = game.split("\n")
|
|
253
|
+
for imp in imports:
|
|
254
|
+
folder, item = imp.rsplit("/", 1)
|
|
255
|
+
at = [i for i, l in enumerate(lines) if l.startswith(f"import {folder}/") and "/" not in l[len(f"import {folder}/"):]]
|
|
256
|
+
if not at:
|
|
257
|
+
last = max(i for i, l in enumerate(lines) if l.startswith("import "))
|
|
258
|
+
lines.insert(last + 1, f"import {folder}/{item}")
|
|
259
|
+
continue
|
|
260
|
+
old = lines[at[0]][len(f"import {folder}/"):]
|
|
261
|
+
names = old.strip("{}").split(", ") if old.startswith("{") else [old]
|
|
262
|
+
if item not in names:
|
|
263
|
+
lines[at[0]] = f"import {folder}/{{" + ", ".join(sorted(names + [item])) + "}"
|
|
264
|
+
open(path, "w").write("\n".join(lines) + drv)
|
|
265
|
+
return path
|
|
266
|
+
|
|
267
|
+
|
|
233
268
|
def write_games(master, out, orb_ticks, bp_ticks, only):
|
|
234
269
|
"""Writes the game drivers into `out` (master's only when `master` is given; only those
|
|
235
270
|
in `only` when it is given) and returns their (name, master, branch) paths."""
|
|
236
271
|
games = [
|
|
237
|
-
("orb_run", "/examples/games/orbitrunner
|
|
272
|
+
("orb_run", "/examples/games/orbitrunner", "OrbitRunner.plum", "fun main(io: Io) -> Game",
|
|
273
|
+
ORB_MASTER, ["std/game/input", "std/math/Vec2"],
|
|
238
|
-
|
|
274
|
+
"examples/games/orb_run.plum", "fun main(io: Io) -> Game<State, Msg>", ORB_BRANCH, orb_ticks, ORB_SEEDS),
|
|
239
|
-
("balloon_pop", "/examples/games/balloonpop
|
|
275
|
+
("balloon_pop", "/examples/games/balloonpop", "BalloonPop.plum", "fun main(io: Io) -> Game",
|
|
276
|
+
BP_MASTER, ["std/game/input", "std/math/Vec2"],
|
|
240
|
-
|
|
277
|
+
"examples/games/kids/balloon_pop.plum", "fun main(io: Io) -> Game<State, Msg>", BP_BRANCH, bp_ticks, BP_SEEDS),
|
|
241
278
|
]
|
|
242
279
|
progs = []
|
|
243
|
-
for name,
|
|
280
|
+
for name, mfolder, mentry, msig, mdrv, mimports, bsrc, bsig, bdrv, ticks, seeds in games:
|
|
244
281
|
if only and name not in only:
|
|
245
282
|
continue
|
|
246
|
-
mp, bp =
|
|
283
|
+
mp, bp = None, f"{out}/{name}_branch.plum"
|
|
247
|
-
sides = [(bp, bsrc, bsig, bdrv)] + ([(mp, master + msrc, msig, mdrv)] if master else [])
|
|
248
|
-
for path, src, sig, drv in sides:
|
|
249
|
-
body = drv.replace("SEEDS", seeds).replace("TICKS", str(ticks))
|
|
250
|
-
|
|
284
|
+
game = strip_main(bsrc, bsig)
|
|
251
|
-
|
|
285
|
+
if name == "orb_run":
|
|
252
|
-
|
|
286
|
+
assert ORB_BRANCH_AGAIN[0] in game, "orb_run's Again changed: update ORB_BRANCH_AGAIN"
|
|
253
|
-
|
|
287
|
+
game = game.replace(*ORB_BRANCH_AGAIN)
|
|
288
|
+
open(bp, "w").write(game + bdrv.replace("SEEDS", seeds).replace("TICKS", str(ticks)))
|
|
289
|
+
if master:
|
|
254
|
-
|
|
290
|
+
mp = master_game(master, out, name, mfolder, mentry, msig,
|
|
291
|
+
mdrv.replace("SEEDS", seeds).replace("TICKS", str(ticks)), mimports)
|
|
255
292
|
progs.append((name, mp, bp))
|
|
256
293
|
return progs
|
|
257
294
|
|
docs/benchmarks/2026-11-11-master-20ae0ea0-vs-simpler-language.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# master 20ae0ea0 against simpler-language: compile time, wasm size and run time
|
|
2
|
+
|
|
3
|
+
Taken 2026-11-11 on an Apple M3 Pro (18 GB), macOS 26.6.2. Master at `20ae0ea0` (a detached worktree, 49 commits after the `e63393fb` of [the morning's run](2026-11-11-master-vs-simpler-language.md)), simpler-language at `f6834793`. The branch's commits since `5d384800` change only `docs/benchmarks` and `benchmarks/`, so its compiler and std are the code measured that morning. Both compilers built with `cargo build --release -p plum-cli`. Every run time is the median of 5 fresh processes, with the range in brackets, in ms. The runs went one benchmark at a time, and each started once the 1-minute load average was at or below 3. All eleven did: the start loads were 2.62 to 3.00, after waits of 0 to 190 s. The load at their end was 2.47 to 4.10 (4.10 after `fib`, 3.58 after `trig`, 3.41 after the scene trees). 4.3 GB of swap was in use.
|
|
4
|
+
|
|
5
|
+
"branch" below means simpler-language. "2026-11-11" means the morning's run against master `e63393fb`.
|
|
6
|
+
|
|
7
|
+
## Short answer
|
|
8
|
+
|
|
9
|
+
- **Same source on both: none**, as before. Every number is from a port or a driver written per branch. Every port that still builds prints the same checksum on both, and so do both games: Orb Run `checksum 871028980 overs 5 scoreAtOver 80 minesAtEnd 40` and Balloon Pop `checksum 234038249 pops 3975`, the morning's values. Master rebuilt both games since then (one screen each, game over as an overlay, no `World` or `Playfield`, split into files; `9ac2ec43`, `3fbb7c95`), and they still play the same games.
|
|
10
|
+
- **Not ported, as before:** `cons` and `cons_rec` (master's `LinkedList` is gone), and master's `game_tree` and `game_enum_tree` scene trees (gone too). Those rows have no master number.
|
|
11
|
+
- **Master's compiler got 3 to 5 times faster, and the branch now compiles slower than master.** Small programs take master 39 to 45 ms of CPU (197 ms that morning), and the branch 3.3x to 3.7x that (2.0x to 2.5x the wall). The Orb Run driver takes master 171 ms (591), and the branch 3.33x the CPU and 2.76x the wall. Balloon Pop takes 2.18x and 1.76x, the scene tree 1.71x and 1.32x. That morning the branch was 0.72x to 1.08x master's CPU.
|
|
12
|
+
- **Master's wasm shrank to about the branch's size.** Small programs went from about 35 KB to 4.5 to 8 KB on master, and the branch's are now 1.03x to 1.13x master's (0.14x to 0.24x that morning). The Orb Run driver is 1.40x master's on the branch (0.69x that morning), Balloon Pop 0.85x (0.56x), the scene tree 0.71x (0.47x).
|
|
13
|
+
- **Both games tick faster on master than on the branch.** Orb Run: 1.56 µs a tick on master against 2.28 µs on the branch (1.45x; it was 0.85x, master took 2.72 µs). Balloon Pop: 0.33 µs against 1.17 µs (3.52x; was 2.94x).
|
|
14
|
+
- **Master's `std/game` scene tree got 10 to 35% faster**, and the branch's tree is now slower on step (1.12x to 1.37x), churn (1.60x to 2.03x), the apply walk (1.86x to 2.35x), eager transforms (1.92x to 2.18x) and hit at N = 10000 (1.12x). It is still faster on draw (0.80x and 0.81x) and on hit at N = 1000 (0.79x), and level on step without transforms at N = 10000 (1.01x).
|
|
15
|
+
- **Micro workloads:** the branch is slower on `map` (2.18x), `particles` (2.16x) and `fib` (1.15x), level on `loop`, `str` and `trig`, and faster on `array` (0.64x, with a wide range on master). Master got 25% faster on `map` and 35% on `particles` since the morning.
|
|
16
|
+
|
|
17
|
+
## Method
|
|
18
|
+
|
|
19
|
+
As in [the morning's run](2026-11-11-master-vs-simpler-language.md#method): the micro workloads are the ports in `benchmarks/master_vs_simpler/{master,branch}/`, the games are headless drivers that `benchmarks/master_vs_simpler/run.py` writes around each branch's own game, and the scene trees run through `benchmarks/scene_trees/run.py`. Each compiler compiles with its own std. Each program ran as its own `run.py --only <name>` (each with its own `--out`), so that each could wait for the load:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
python3 benchmarks/master_vs_simpler/run.py --master <master> --only <name> --out <dir> # one per program
|
|
23
|
+
python3 benchmarks/scene_trees/run.py --master <master> --master-plum <master>/target/release/plum \
|
|
24
|
+
--plum target/release/plum --sizes 1000,10000
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**What had to change for master `20ae0ea0`** (benchmark code only; no game, std or compiler code was changed on either side):
|
|
28
|
+
|
|
29
|
+
- **Micro ports** (`benchmarks/master_vs_simpler/master/*.plum`): the import lines are now one group, `import std/{Float, Int, Io, ...}`, with only what the program uses, since an unused import is now an error on master (`c145bc4e`). `List` and `Map` come from `std/` (`19407989`). Generics are `<>` (`95098e99`): `List<Int>()`, `List<P>()`. `Map[Int, Int]()` became `m: Map<Int, Int> := Map.empty()`, and `m.get(k).unwrapOr(0)` became `m.get(k) ?: 0` (Option is gone, `get` returns `V?`; `8df6a7c5`). The algorithms and data are unchanged, and the checksums are the morning's.
|
|
30
|
+
- **Game drivers.** Master's games are now folders (`examples/games/orbitrunner/{OrbitRunner.plum, state.plum, screens/, actors/}`, the same for `balloonpop`), and a program imports its own modules by path, so the old `strip_main` of one file can't make master's driver. `run.py` now copies the whole game folder into `--out`, strips `main` and the tests from the copy of the entry file, and appends the driver there. So the game's state, screen and actors are master's own files, unchanged. The driver's names are merged into the entry file's import groups (`std/game/{..., input}`, `std/math/{..., Vec2}`), since master rejects two import lines for one folder. The driver builds the game as master's own `Headless` test helpers do: `Game(screens: [PlayingScreen(rng: Random.seeded(seed), sheet: Texture.none(), run: run)], state: run)` with `run := RunState.create()` for Orb Run, and `PlaygroundScreen.seeded(seed, PopState.create())` for Balloon Pop. It calls `g.update(io, input.sized(800.0, 600.0), 1.0 / 60.0)` each tick and reads `run.score`, `run.lives`, `run.over`, `play.mines.length()` and `field.run.pops`, where it used to read `g.world.run` and `g.field.run`. The inputs are the same functions of seed and tick as before. The branch's drivers are unchanged.
|
|
31
|
+
- **Same game?** Both master drivers print the morning's checksums, including the count of game overs (5), the score at each (80 in all) and the mines on the field at the end (40). Master's restart rebuilds the play screen from the `Random` the screen has carried on, which is what `World.restart` did, so the `ORB_BRANCH_AGAIN` rule the branch's Orb Run is given still matches.
|
|
32
|
+
- `scene_trees/run.py` is unchanged. As in the morning, `game_tree` and `game_enum_tree_kept` don't build on master and are left out, and master's `benchmarks/scene_trees/game.plum` (the `std/game` tree) builds and runs as it is on master. Every cell's checksum agreed between it and the three branch builds on every run.
|
|
33
|
+
|
|
34
|
+
**Compile time and wasm size** come from a scratch script, as in the morning: it times `plum compile` of the same sources (the micro ports, the two drivers `run.py` wrote, and the scene-tree programs) with `wait4` on the child, user plus sys CPU and wall, 5 rounds, alternating master and the branch. "fns" is read from the wasm: defined functions, and imported ones in brackets.
|
|
35
|
+
|
|
36
|
+
## Micro workloads (ports, same checksums)
|
|
37
|
+
|
|
38
|
+
| program | master | branch | branch --no-fbip | branch --no-fusion | branch / master | 2026-11-11 | master e63393fb |
|
|
39
|
+
|---|---|---|---|---|---|---|---|
|
|
40
|
+
| fib | 141 (139-164) | 162 (152-182) | 154 (151-184) | 158 (152-193) | **1.15x** | 1.09x | 138 |
|
|
41
|
+
| loop | 299 (274-301) | 300 (281-306) | 307 (283-330) | 299 (286-315) | 1.00x | 0.99x | 322 |
|
|
42
|
+
| array | 99 (69-111) | 63 (63-92) | 63 (63-90) | 64 (63-100) | **0.64x** | 0.56x | 112 |
|
|
43
|
+
| map | 132 (118-140) | 288 (283-299) | 501 (453-655) | 490 (463-582) | **2.18x** | 1.63x | 177 |
|
|
44
|
+
| cons | - | - | - | - | - | - | - |
|
|
45
|
+
| cons_rec | - | - | - | - | - | - | - |
|
|
46
|
+
| str | 593 (586-638) | 593 (592-628) | 597 (594-609) | 595 (593-634) | 1.00x | 0.86x | 699 |
|
|
47
|
+
| particles | 80 (80-99) | 174 (173-205) | 174 (173-189) | 174 (173-203) | **2.16x** | 1.43x | 123 |
|
|
48
|
+
| trig | 47 (47-71) | 47 (47-73) | 47 (46-77) | 47 (46-75) | 0.99x | 1.00x | 48 |
|
|
49
|
+
|
|
50
|
+
`cons` and `cons_rec` weren't run: they need master's `LinkedList`. The branch's numbers are within 3% of the morning's except `fib` (162 against 151; the load was 4.1 at that run's end, and the branch's `--no-fbip` build, the same code for `fib`, took 154) and `str` (593 against 599). Master's `array` range is wide (69 to 111 ms); its fastest run is level with the branch. As in the morning, `map` compares the branch's persistent weight-balanced tree with master's hash table.
|
|
51
|
+
|
|
52
|
+
## Scene trees (different code, same scene, same checksums)
|
|
53
|
+
|
|
54
|
+
Master's `std/game` (`benchmarks/scene_trees/game.plum`, master's compiler and std) against the branch's `benchmarks/scene_trees/scene_tree.plum`. Both time themselves with `io.nowMicros()`. Every cell's checksum agreed across all four versions on every run.
|
|
55
|
+
|
|
56
|
+
| workload | N | master std/game | branch | branch --no-fbip | branch --no-fusion | branch / std/game | 2026-11-11 | master e63393fb |
|
|
57
|
+
|---|---|---|---|---|---|---|---|---|
|
|
58
|
+
| step | 1000 | 12 (12-13) | 17 (17-17) | 17 (17-17) | 17 (16-18) | **1.37x** | 0.96x | 18 |
|
|
59
|
+
| step | 10000 | 130 (129-133) | 145 (144-149) | 147 (145-166) | 145 (145-149) | **1.12x** | 0.80x | 187 |
|
|
60
|
+
| churn | 1000 | 15 (14-15) | 30 (29-31) | 30 (29-31) | 30 (29-30) | **2.03x** | 1.38x | 22 |
|
|
61
|
+
| churn | 10000 | 167 (165-169) | 268 (267-278) | 267 (267-290) | 267 (266-273) | **1.60x** | 1.13x | 240 |
|
|
62
|
+
| draw | 1000 | 33 (32-34) | 26 (26-28) | 26 (26-27) | 27 (27-28) | 0.80x | 0.77x | 35 |
|
|
63
|
+
| draw | 10000 | 306 (305-329) | 247 (244-277) | 246 (244-252) | 250 (248-255) | **0.81x** | 0.72x | 346 |
|
|
64
|
+
| hit | 1000 | 23 (23-24) | 18 (18-19) | 18 (18-19) | 19 (19-20) | 0.79x | 0.78x | 24 |
|
|
65
|
+
| hit | 10000 | 159 (156-161) | 178 (176-184) | 179 (177-181) | 186 (183-190) | **1.12x** | 0.98x | 185 |
|
|
66
|
+
| step, no transforms | 1000 | 12 (12-13) | 15 (15-16) | 15 (15-16) | 15 (15-16) | **1.23x** | 0.84x | 18 |
|
|
67
|
+
| step, no transforms | 10000 | 130 (129-144) | 130 (130-161) | 131 (130-136) | 131 (129-134) | 1.01x | 0.71x | 187 |
|
|
68
|
+
| step, eager transforms | 1000 | 19 (19-20) | 41 (41-42) | 41 (41-42) | 42 (41-43) | **2.18x** | 1.67x | 25 |
|
|
69
|
+
| step, eager transforms | 10000 | 205 (200-216) | 392 (389-404) | 392 (386-408) | 398 (395-399) | **1.92x** | 1.47x | 281 |
|
|
70
|
+
| churn, apply after | 1000 | 14 (14-15) | 34 (33-34) | 33 (33-34) | 34 (33-34) | **2.35x** | 1.53x | 22 |
|
|
71
|
+
| churn, apply after | 10000 | 166 (164-171) | 307 (306-312) | 308 (306-313) | 307 (306-312) | **1.86x** | 1.27x | 246 |
|
|
72
|
+
|
|
73
|
+
The branch's medians are within 5% of the morning's in every row (step 145 against 149 at N = 10000, eager transforms 392 against 413), so the ratios moved because master moved. The branch alone, for the workloads master never had: step with 60 kept 21 ms at N = 1000 and 1,591 ms at 10000, churn with 60 kept 34 and 1,734 ms, mostly still 13 and 111 ms, mostly still in one group 12 and 108 ms.
|
|
74
|
+
|
|
75
|
+
## Games (headless, ported drivers)
|
|
76
|
+
|
|
77
|
+
| game | ticks | master | branch | branch --no-fbip | branch --no-fusion | branch / master | per tick, master / branch | 2026-11-11 |
|
|
78
|
+
|---|---|---|---|---|---|---|---|---|
|
|
79
|
+
| Orb Run | 13 seeds × 3000 | 61 (61-65) | 89 (88-123) | 88 (88-88) | 89 (88-119) | **1.45x** | 1.56 / 2.28 µs | 0.85x (2.72 / 2.31 µs) |
|
|
80
|
+
| Balloon Pop | 6 seeds × 20000 | 40 (40-51) | 140 (139-176) | 139 (138-169) | 140 (139-171) | **3.52x** | 0.33 / 1.17 µs | 2.94x (0.40 / 1.18 µs) |
|
|
81
|
+
|
|
82
|
+
Both print the morning's checksums on master and on all three branch builds: Orb Run `checksum 871028980 overs 5 scoreAtOver 80 minesAtEnd 40`, Balloon Pop `checksum 234038249 pops 3975`. Master's two games are rebuilt code since the morning (see [Method](#method)), but the checksums say they are the same games, step for step. The branch's tick is unchanged (2.28 against 2.31 µs, 1.17 against 1.18 µs). Master's Orb Run tick fell 43% (2.72 to 1.56 µs) and its Balloon Pop tick 18% (0.40 to 0.33 µs).
|
|
83
|
+
|
|
84
|
+
## Compile time and wasm size
|
|
85
|
+
|
|
86
|
+
`plum compile`, median of 5. CPU ms is user plus sys; wall ms is the median wall time. "fns" counts defined functions, imported ones in brackets.
|
|
87
|
+
|
|
88
|
+
| program | master CPU ms | branch CPU ms | ratio | master wall ms | branch wall ms | ratio | master wasm bytes | branch wasm bytes | ratio | master fns | branch fns | 2026-11-11 CPU / wasm ratio |
|
|
89
|
+
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
90
|
+
| fib | 39 (38-43) | 130 (128-137) | **3.34x** | 40 | 82 | 2.03x | 4,524 | 4,697 | 1.04x | 43 (+3) | 45 (+3) | 0.73x / 0.14x |
|
|
91
|
+
| loop | 39 (38-39) | 132 (131-134) | **3.41x** | 40 | 82 | 2.04x | 4,556 | 4,731 | 1.04x | 43 (+3) | 45 (+3) | 0.73x / 0.14x |
|
|
92
|
+
| array | 39 (39-41) | 133 (132-136) | **3.39x** | 41 | 84 | 2.08x | 5,210 | 5,538 | 1.06x | 47 (+3) | 54 (+3) | 0.74x / 0.16x |
|
|
93
|
+
| map | 45 (45-47) | 168 (164-172) | **3.73x** | 47 | 116 | 2.48x | 6,156 | 6,596 | 1.07x | 53 (+3) | 56 (+3) | 0.90x / 0.18x |
|
|
94
|
+
| str | 39 (38-39) | 133 (128-134) | **3.43x** | 40 | 81 | 2.03x | 4,588 | 4,765 | 1.04x | 42 (+3) | 45 (+3) | 0.72x / 0.14x |
|
|
95
|
+
| particles | 40 (40-41) | 141 (139-143) | **3.53x** | 41 | 91 | 2.22x | 5,633 | 6,387 | 1.13x | 50 (+3) | 61 (+3) | 0.84x / 0.18x |
|
|
96
|
+
| trig | 42 (42-42) | 140 (138-140) | **3.35x** | 43 | 88 | 2.05x | 8,061 | 8,304 | 1.03x | 58 (+3) | 61 (+3) | 0.77x / 0.24x |
|
|
97
|
+
| Orb Run driver | 171 (171-173) | 570 (566-576) | **3.33x** | 172 | 476 | 2.76x | 52,617 | 73,477 | **1.40x** | 429 (+31) | 550 (+18) | 1.06x / 0.69x |
|
|
98
|
+
| Balloon Pop driver | 232 (232-236) | 506 (499-519) | **2.18x** | 234 | 411 | 1.76x | 61,002 | 51,597 | 0.85x | 500 (+58) | 378 (+14) | 1.08x / 0.56x |
|
|
99
|
+
| scene tree | 221 (221-225) | 378 (373-382) | **1.71x** | 223 | 296 | 1.32x | 46,385 | 33,089 | 0.71x | 326 (+53) | 247 (+9) | 1.01x / 0.47x |
|
|
100
|
+
|
|
101
|
+
Master's compiler is still single-threaded (CPU and wall agree); the branch's loader parses on several threads. The branch's wasm sizes and function counts are byte for byte the morning's. Its CPU times are 6 to 10% under the morning's on the same code (Orb Run 570 against 626 ms), which shows how much these moved with the machine between the two runs.
|
|
102
|
+
|
|
103
|
+
## Against 2026-11-11 (master e63393fb)
|
|
104
|
+
|
|
105
|
+
Branch / master ratios, morning and now, and what moved. The branch's code is the same in both, so nearly all the movement is master's.
|
|
106
|
+
|
|
107
|
+
| measure | 2026-11-11 | now | what moved |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| compile CPU, micro ports | 0.72x to 0.90x | 3.34x to 3.73x | master about 197 to about 40 ms; branch about 145 to about 135 |
|
|
110
|
+
| compile CPU, Orb Run driver | 1.06x | 3.33x | master 591 to 171; branch 626 to 570 |
|
|
111
|
+
| compile CPU, Balloon Pop driver | 1.08x | 2.18x | master 508 to 232; branch 548 to 506 |
|
|
112
|
+
| compile CPU, scene tree | 1.01x | 1.71x | master 402 to 221; branch 407 to 378 |
|
|
113
|
+
| wasm, micro ports | 0.14x to 0.24x | 1.03x to 1.13x | master about 35 KB to 4.5 to 8 KB; branch unchanged |
|
|
114
|
+
| wasm, Orb Run driver | 0.69x | 1.40x | master 105,755 to 52,617 bytes (999 to 429 functions) |
|
|
115
|
+
| wasm, Balloon Pop driver | 0.56x | 0.85x | master 92,476 to 61,002 (858 to 500 functions) |
|
|
116
|
+
| wasm, scene tree | 0.47x | 0.71x | master 70,003 to 46,385 (687 to 326 functions) |
|
|
117
|
+
| Orb Run tick | 0.85x | 1.45x | master 2.72 to 1.56 µs; branch 2.31 to 2.28 |
|
|
118
|
+
| Balloon Pop tick | 2.94x | 3.52x | master 0.40 to 0.33 µs; branch 1.18 to 1.17 |
|
|
119
|
+
| scene tree step, N = 10000 | 0.80x | 1.12x | master 187 to 130 ms; branch 149 to 145 |
|
|
120
|
+
| scene tree churn, N = 10000 | 1.13x | 1.60x | master 240 to 167; branch 272 to 268 |
|
|
121
|
+
| scene tree draw, N = 10000 | 0.72x | 0.81x | master 346 to 306; branch 251 to 247 |
|
|
122
|
+
| scene tree hit, N = 10000 | 0.98x | 1.12x | master 185 to 159; branch 182 to 178 |
|
|
123
|
+
| scene tree eager transforms, N = 10000 | 1.47x | 1.92x | master 281 to 205; branch 413 to 392 |
|
|
124
|
+
| fib | 1.09x | 1.15x | master 138 to 141; branch 151 to 162 (load, see above) |
|
|
125
|
+
| loop | 0.99x | 1.00x | master 322 to 299 (the morning's master range was wide); branch 320 to 300 |
|
|
126
|
+
| array | 0.56x | 0.64x | master 112 to 99 (range 69 to 111); branch 63 to 63 |
|
|
127
|
+
| map | 1.63x | 2.18x | master 177 to 132; branch 288 to 288 |
|
|
128
|
+
| str | 0.86x | 1.00x | master 699 to 593; branch 599 to 593 |
|
|
129
|
+
| particles | 1.43x | 2.16x | master 123 to 80; branch 175 to 174 |
|
|
130
|
+
| trig | 1.00x | 0.99x | level on both |
|
|
131
|
+
|
|
132
|
+
## What stands out
|
|
133
|
+
|
|
134
|
+
Measured:
|
|
135
|
+
|
|
136
|
+
1. **Master's compiler is now the faster one, by a lot.** It compiles a small program in about 40 ms of CPU, against 197 ms that morning, and the Orb Run driver in 171 ms against 591. The branch, unchanged, now takes 3.3x to 3.7x master's CPU on small programs and 2.2x to 3.3x on the games, and 1.3x to 2.8x the wall time even with its loader's threads.
|
|
137
|
+
2. **Master's wasm lost most of its std.** Small programs dropped from about 35 KB and 320 functions to 4.5 to 8 KB and 42 to 58 functions: about what the branch emits, which is now 1.03x to 1.13x master's size. The Orb Run driver's function count fell from 999 to 429, and it is now smaller on master than on the branch (1.40x). Balloon Pop and the scene tree are still smaller on the branch (0.85x and 0.71x).
|
|
138
|
+
3. **Master's run times fell too, the branch's didn't move.** Master's Orb Run tick fell 43%, `particles` 35%, `map` 25%, its scene-tree step, churn and eager transforms 25 to 35%. Every branch run time is within 5% of the morning's, except `fib` (7%, under higher load). So every ratio that moved, moved because master did.
|
|
139
|
+
4. **The branch is now slower than master on both games** (1.45x and 3.52x a tick) and on every scene-tree workload but draw and the small hit. It still wins on `array` (0.64x), draw (0.80x) and hit at N = 1000 (0.79x).
|
|
140
|
+
5. **`--no-fbip` and `--no-fusion` still change only `map`** (288 to 501 and 490 ms) among these programs.
|
|
141
|
+
|
|
142
|
+
Guesses, not measured:
|
|
143
|
+
|
|
144
|
+
- Master's compile-time and size drop most likely comes from the `imp/compiler` merge (`4a5e6472`): `efe61ab9` (functions nothing reaches are dropped), `1a922f12` (imported code pruned before the check, smaller modules), `97d11013` (tiny functions inlined) and `3c310f4f` (redundant `ref.cast`s dropped). The commits weren't measured apart.
|
|
145
|
+
- Master's faster `particles` and `map` most likely come from the same inlining and `ref.cast` commits. Its faster Orb Run is most likely the rebuilt game (`9ac2ec43`: no `World`, one screen) together with `56ada25f` (a moved place adds offsets instead of multiplying matrices), which would also explain the scene tree's step, churn and eager-transform gains. No profile was taken.
|
|
146
|
+
- Balloon Pop's gap (3.52x) is still most likely a fixed cost per tick in the branch's `Game.step`, as on the earlier runs; master's Balloon Pop now draws with `gfx` from a plain list and keeps an empty tree, so its tick has even less fixed cost than before.
|
|
147
|
+
|
|
148
|
+
## Caveats
|
|
149
|
+
|
|
150
|
+
- Every comparison is between ports or per-branch drivers. Two ports and two of master's scene trees have no master side any more.
|
|
151
|
+
- Master's game code is rebuilt since the morning (and since 2026-11-09). The checksums, including game overs, scores at game over and mines at the end, say it plays the same games. No row is a different game.
|
|
152
|
+
- Each benchmark started at a load of 3.0 or less, but the load rose to up to 4.1 during some (the `fib` run most). 4.3 GB of swap was in use. Some maxima are wide (a few runs 20 to 40% over the median); the medians are tight.
|
|
153
|
+
- The branch's compile CPU came out 6 to 10% under the morning's on the same code. Compile ratios across the two runs carry that much noise; within this run, master and the branch alternated.
|
|
154
|
+
- Only update ticks are timed for the games.
|
|
155
|
+
|
|
156
|
+
## How to rerun
|
|
157
|
+
|
|
158
|
+
From a simpler-language checkout at or after this commit, with master's compiler built in a separate checkout (master `20ae0ea0` or later, whose games are folders):
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
cargo build --release -p plum-cli
|
|
162
|
+
git worktree add --detach <master> master && (cd <master> && cargo build --release -p plum-cli)
|
|
163
|
+
python3 benchmarks/master_vs_simpler/run.py --master <master> --only fib,loop,array,map,str,particles,trig,orb_run,balloon_pop
|
|
164
|
+
python3 benchmarks/scene_trees/run.py --master <master> --master-plum <master>/target/release/plum \
|
|
165
|
+
--plum target/release/plum --sizes 1000,10000
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The micro ports and games took about 2 minutes of running (plus 6 minutes of waiting for the load), the scene trees under 2 minutes, and the compile timings under 15 seconds.
|