def message
bend-lint-rules@0.2.0.0 · performance/dead_accumulator.bend:24
import bend-lint-rules@0.2.0.0/performance/dead_accumulator.bend as DeadAccumulator
import Base
24
25
26def message(+name: String, loop: String) -> String:
27 name
28 ++ " only grows: "
29 ++ loop
30 ++ " passes it to itself with something added, and nothing reads it, so Bend builds it on every step and frees it at the end. All lanes. Measured on the CPU, in bend-ml's BPE encode, where such a list, built per word, was half of the time: 26.1 s to tokenize 19 KB of text, against 11.5 s after the fix. Confidence: medium, as the gain is what building it costs. Erase it, with `-"
31 ++ name
32 ++ "`: the checker keeps it for proofs, and the compiler deletes it; or remove it. If it gets only a few small items, expect this finding."