Appender is ... slow
    monarch_dodra via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Aug 15 09:48:08 PDT 2014
    
    
  
On Friday, 15 August 2014 at 14:40:36 UTC, Philippe Sigaud wrote:
> Well, I created a wrapper around a std.array.uninitializedArray 
> call, to manage the interface I need
Make sure you don't use that if your type has elaborate 
construction, or assumes a certain initial state (unless you are 
actually emplacing your objects of course).
> I thought that, having lots of concatenation in my code, that'd 
> be a bottleneck. But it appears than pre-allocation does not 
> give me any speed-up.
If you are using "raw GC arrays", then the "raw" append operation 
will, outweigh the relocation cost on extension. So 
pre-allocation wouldn't really help in this situation (though the 
use of Appender *should*)
    
    
More information about the Digitalmars-d-learn
mailing list