Lexer in D
Namespace
rswhite4 at googlemail.com
Mon Mar 11 08:37:54 PDT 2013
On Monday, 11 March 2013 at 15:21:31 UTC, FG wrote:
> On 2013-03-11 16:11, Namespace wrote:
>> I've also done some benchmarks. And I wonder why my appender
>> is much faster if I
>> enable memory reservation.
>
> Probably just because D's Appender has a better growth scheme
> than yours and you reallocate too often. Try to compare how
> often that happens.
D's:
24 extends, 9 moves (qalloc + memcpy).
My Appender:
25 moves.
But I do not think you can extend a memory block with C functions.
>> I'm also very interested to hear some improvements tips.
>
> Well, you may add a check whether alloc/realloc actually
> succeeded. :)
Maybe. :)
More information about the Digitalmars-d-learn
mailing list