From 5df2e814937e32a54c77c1ded66b5124e6017cfc Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 19 Oct 2026 05:16:07 +0100 Subject: CONCAT with an empty side gives the other as it is, uncopied (values do not change), so a bytes state joined while empty (HTTP's pending + packet.data) no longer copies the packet: HTTP a packet at a time 288 to 270 ns a byte at the same instructions, as the old app (270.0); counts: b48 against b47 knapsack without batches -0.42%, join -0.16%, BFS with batches -0.12%, the rest within 0.03%; the bank's queries (s47 and s48 in turns, six each) in_credit -0.34%, field -0.34%, found -0.22%, per_branch -0.20%, large -0.18%, ranks -0.13%, none the same, the seven answers the same bytes --- core/module.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/module.c') diff --git a/core/module.c b/core/module.c index 621a510..3a6c4b5 100644 --- a/core/module.c +++ b/core/module.c @@ -3980,6 +3980,8 @@ static inline __attribute__((always_inline)) int step(Frame *frame, const PureOp } case PURE_OP_CONCAT: { PureBytes right = stack[--sp].bytes, left = stack[sp - 1].bytes; + if (!right.length) NEXT; /* joined with nothing: the other as it is, uncopied (values do not change) */ + if (!left.length) { stack[sp - 1].bytes = right; NEXT; } size_t start = arena->used; if ((status = append_value(app, arena, left)) != PURE_OK || (status = append_value(app, arena, right)) != PURE_OK) STOPPED(status); -- cgit v1.2.3