[Issue 1339] Invariant/const-ness is broken by built-in array properties

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 19 16:06:27 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=1339





------- Comment #8 from 2korden at gmail.com  2009-02-19 18:06 -------
(In reply to comment #7)
> Oh yes.  Increasing .length always reallocates under 2.025, whether const,
> invariant or not.  The problem is that concatenation doesn't.
> 

Do you say that the following:
char[] s;
for (int i = 0; i < 10_000_000; ++i) {
    s ~= '0';
    // or:
    // s.length = s.length + 1; 
    // s[$-1] = '0';
}

will reallocate on *each* iteration?
While this solves one issue, it opens another one - big performance drop
(create new report?)


-- 



More information about the Digitalmars-d-bugs mailing list