Stream: bugs

Topic: In-place mutation perf bug depending on the list init


view this post on Zulip Matthieu Pizenberg (Aug 18 2026 at 13:59):

I’ve recorded the perf issue here: https://github.com/roc-lang/roc/issues/10848

Basically, in-place mutation is not triggered while looping List.set if the list is is initialized from a function call.

# fast
var $s = { x: List.repeat(0.U64, len), y: 0 }

# slow
var $s = new(len)

new = |n| { x: List.repeat(0.U64, n), y: 0 }

# the loop
while $i < n {
    $s = { ..$s, x: $s.x.set(0, $i) ?? $s.x }
    $i = $i + 1
}

Last updated: Sep 03 2026 at 15:16 UTC