aboutsummaryrefslogtreecommitdiffstats
path: root/research
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-06 05:11:53 +0100
committereunhhu <[email protected]>2026-10-06 05:11:53 +0100
commitd1080f31d941d78399e67ad2f8108c3344f6c014 (patch)
tree7c5766a522a7668913cea7cf4700358af2d9cf7a /research
parentb94de93a5ae36bab5e00b5b479afeb59e9702a61 (diff)
downloadpure-d1080f31d941d78399e67ad2f8108c3344f6c014.tar.gz
pure-d1080f31d941d78399e67ad2f8108c3344f6c014.zip
Batch: a recurrence's steps each an operation of two numbers a round keeps (a step's result, a recurrence's value, the loop's value, a number that stays) rather than a stack's pushes and pops, an operation computed twice in its statement once (x the same until it is done): 1,000,000 rounds of MINSTD 44.4 to 25.7 ms (the compiled code 18.5, the executor alone 73.0); costs/recur.aup
Diffstat (limited to 'research')
-rw-r--r--research/experiments/041-batches/costs/recur.aup11
1 files changed, 11 insertions, 0 deletions
diff --git a/research/experiments/041-batches/costs/recur.aup b/research/experiments/041-batches/costs/recur.aup
new file mode 100644
index 0000000..fb56004
--- /dev/null
+++ b/research/experiments/041-batches/costs/recur.aup
@@ -0,0 +1,11 @@
+state out = 0
+input go = message {
+ n: u32
+}
+on go {
+ let x = 1
+ for i in 0 .. go.n * 1000 {
+ x = x * 48271 - floor(x * 48271 / 2147483647) * 2147483647
+ }
+ out = x
+}