Appender is ... slow

Dicebot via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 14 13:50:36 PDT 2014


On Thursday, 14 August 2014 at 20:42:08 UTC, Philippe Sigaud via 
Digitalmars-d-learn wrote:
> You mean by using the shrinkTo method? (Appender does not have a
> length, that's a bit of a bother btw).
> I just did, it does not change anything. Too bad.
>
> Heck, my code is simpler to read and use *and* faster by using a
> bog-standard D array. I'll keep my array for now :)

Oh crap I had std.array.Array in mind which does have `length` 
exposes. And Appender seems to indeed clear / shrink data in a 
horrible way:

https://github.com/D-Programming-Language/phobos/blob/master/std/array.d#L2597
https://github.com/D-Programming-Language/phobos/blob/master/std/array.d#L2611

Wow, this thing is real garbage!


More information about the Digitalmars-d-learn mailing list