aboutsummaryrefslogtreecommitdiffstats
path: root/compiler/compile.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 06:15:12 +0100
committereunhhu <[email protected]>2026-10-19 06:15:12 +0100
commite5a620916c8f13a5a22d24b7fd5a802139bf575f (patch)
tree5e64207f8af9b3902428689e4d477f1f915e2b3a /compiler/compile.c
parent63f6ec316c2b14d8f06036b433da88131c66ef0f (diff)
downloadaup-e5a620916c8f13a5a22d24b7fd5a802139bf575f.tar.gz
aup-e5a620916c8f13a5a22d24b7fd5a802139bf575f.zip
A message's rows read by position where they are, not from a copy of them: input.rows[k] made the rows a list value (LIST_VALUE copies every row) and read the copy, so each read cost the rows' count (140's box layout: 99,067 ns a node, 4,737 now, the answers the same); rows_at in make check (a literal, a computed and a looped position, through a let and a fn's argument, past the last failing the event); no other module of aup's, Pure's or Vega's changes
Diffstat (limited to 'compiler/compile.c')
-rw-r--r--compiler/compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/compile.c b/compiler/compile.c
index 0fcaa1b..5c88b97 100644
--- a/compiler/compile.c
+++ b/compiler/compile.c
@@ -3738,6 +3738,11 @@ static Kind value(Compiler *c, const Expr *e, bool handler, int height) {
return field_value(r, field);
}
case E_INDEX: {
+ int given = e->count == 2 ? rows_list(c, e->args[0]) : -1;
+ if (given >= 0) { /* a message's rows' item at a position: read where they are, not from a copy of them */
+ item_of(c, e->args[1], handler, height, given);
+ return item_value(c, e, given);
+ }
Kind base = value(c, e->args[0], handler, height);
if (base.type == LIST && e->count == 2) { /* a list value's item at a position */
int reg = bind_list(c, e, base);