Appender is ... slow

Philippe Sigaud via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 15 04:30:32 PDT 2014


> It is very different with better compiler though :
>
> $ ldmd2 -release -O a.d
> $ ./appendertest
> Appender.put       :378 ms, 794 μs, and 9 hnsecs
> Appender ~=        :378 ms, 416 μs, and 3 hnsecs
> Std array          :2 secs, 222 ms, 256 μs, and 2 hnsecs
> Std array.reserve  :2 secs, 199 ms, 64 μs, and 5 hnsecs
> Array              :349 ms and 250 μs
> Array.reserve      :347 ms, 694 μs, and 1 hnsec
> new T[]()          :37 ms, 989 μs, and 8 hnsecs
> uninitializedArray :39 ms, 333 μs, and 3 hnsecs
>
> (size 10_000)

OK, same here, except std array gives me only 1.4 s, while the other
timings are about the same. (0.14 alpha2 : ldmd2 -O -inline).
Drat, that means testing on many different compilers. Oh well, let's
start small: pre-allocating, better algorithms, then I'll do real
speed instrumentation.



More information about the Digitalmars-d-learn mailing list