Appender is ... slow
    Jonathan M Davis via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Aug 15 14:24:24 PDT 2014
    
    
  
On Friday, 15 August 2014 at 16:48:10 UTC, monarch_dodra wrote:
> 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*)
Is that because it's able to grab memory from the GC without 
actually having to allocate anything? Normally, I would have 
expected allocations to far outweigh the cost on extension and 
that preallocating would help a lot. But that would be with 
malloc or C++'s new rather than the GC, which has already 
allocated memory to reuse after it collects garbage.
- Jonathan M Davis
    
    
More information about the Digitalmars-d-learn
mailing list