Appender is ... slow

Vladimir Panteleev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 15 04:16:00 PDT 2014


On Thursday, 14 August 2014 at 18:31:15 UTC, Dicebot wrote:
> I don't know much about Phobos appender implementation details 
> but the key thing with reusable buffer is avoid freeing them. 
> AFAIR Appender.clear frees the allocated memory but 
> `Appender.length = 0` does not, making it possible to just 
> overwrite stuff again and again.
>
> Won't promise you anything though!

Appender has no .length property, and .clear does rewind the 
write pointer without deallocating memory, thus allowing you to 
reuse the buffer.


More information about the Digitalmars-d-learn mailing list