Array append performance 2
BCS
ao at pathlink.com
Mon Sep 1 17:40:15 PDT 2008
Reply to Benji,
> bearophile wrote:
>
>> Well, a finished version of ArrayBuilder is in my libs, in the
>> 'builders' module: http://www.fantascienza.net/leonardo/so/libs_d.zip
>>
>> I have already used it to replace the old string appending used in
>> the putr() (printing functions) and now printing is about 2.5 times
>> faster (and using it for that purpose is a way to perform hundreds of
>> unit tests on ArrayBuilder), so I'm quite pleased.
>>
>> Bye, and thank you for all the help and answers (but more bugs can be
>> present still), bearophile
>>
> Very cool.
>
> Philosophically, though, isn't the whole purpose of having dynamic
> arrays in D to avoid having to create library implementations like
> this?
>
> I can definitely appreciate how something like this provides
> proof-of-concept for compiler & stdlib improvements, but in the end,
> having to rely on an array-builder class seems very non-D-ish.
>
> Thoughts?
>
> --benji
>
I think that in many cases the information needed for the compiler to produce
the needed optimizations is to hard to encode in D like languages. D can
handle the individual cats but when to do the rest is a problem that can
span to much code to expect the compiler to solve it. A human with knowledge
of what is supposed to happen can use libs to improve the situation.
OTOH the best solution would be to describe programs in a way that lets a
computer do that work. We can dream.
More information about the Digitalmars-d
mailing list