4 ms·
>This always copies and will lead to quadratic performance In D, "a ~ b" always copies but "a ~= b" might not. Also, appending using ~= will grow the array exp
by edmccard 12y ago
>This always copies and will lead to quadratic performance
In D, "a ~ b" always copies but "a ~= b" might not. Also, appending using ~= will grow the array exponentially, so the amoritized performance will be better than quadratic.
Doing "x.length += 1", however, does incremental growth and will have poor performance.
(See http://dlang.org/arrays.html http://dlang.org/arrays.html and http://forum.dlang.org/post/op.wuic5nateav7ka@stevens-macbook-pro.local http://forum.dlang.org/post/op.wuic5nateav7ka@stevens-macboo... )