aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/http/scores.aup
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 16:56:08 +0100
committereunhhu <[email protected]>2026-09-26 16:56:08 +0100
commit768317d789a01d722fe7455d792fed11e6579b5c (patch)
treee3a6407c8e46351daba04a5ae5f56b013464e516 /benchmarks/http/scores.aup
parent6177f07292682cf5dbf5e91ce101ce116c858e67 (diff)
downloadpure-768317d789a01d722fe7455d792fed11e6579b5c.tar.gz
pure-768317d789a01d722fe7455d792fed11e6579b5c.zip
Benchmark an app served by its views and inputs
run.py --suite app serves the scoreboard of scores.aup (22 lines of aup) with pure-serve against the same scoreboard written by hand in axum and drogon: POST /inputs/score?points=N with a name as the body, GET /views/total and a page of 20 rows as JSON. Durable, the baselines append each score to a log and fdatasync it before answering (replayed at start); the load generator learns the three requests.
Diffstat (limited to 'benchmarks/http/scores.aup')
-rw-r--r--benchmarks/http/scores.aup22
1 files changed, 22 insertions, 0 deletions
diff --git a/benchmarks/http/scores.aup b/benchmarks/http/scores.aup
new file mode 100644
index 0000000..8683bf2
--- /dev/null
+++ b/benchmarks/http/scores.aup
@@ -0,0 +1,22 @@
+# The scoreboard of the app benchmarks (run.py --suite app), which the axum
+# and drogon baselines write by hand: pure-serve serves its views and inputs,
+# with no routes, handlers or storage code written.
+record Entry {
+ name: text
+ points = 0
+}
+state board: list of Entry by name
+input score = message {
+ points: u32
+ name: bytes
+}
+on score {
+ if !board.has(text(score.name)) { board.add(Entry { name: text(score.name) }) }
+ board[text(score.name)].points = board[text(score.name)].points + score.points
+ reply score.name
+}
+view total = sum(e.points for e in board)
+view leaders = each e in board {
+ name = e.name
+ points = e.points
+}