2 ms·
Just because it is an immutable value doesn’t mean it needs to live on the stack. That said, I was wondering about a similar thing: what if I modify a 1GB stri
by zupa-hu 3y ago
Just because it is an immutable value doesn’t mean it needs to live on the stack.
That said, I was wondering about a similar thing: what if I modify a 1GB string? Is it copy-on-write?
I feel like it can be optimized away 99% of the time only to leave you with 1% of cases that result in very-hard-to-find performance degradations.
- ezekiel68 3y ago> Just because it is an immutable value doesn’t mean it needs to live on the stack. Right. But the context of the example made me imagine it probably was -- since I would likely reject out-of-hand any new language that always allocated variables on the heap.