On Friday, 15 August 2014 at 08:35:41 UTC, Philippe Sigaud via Digitalmars-d-learn wrote:
I wonder if using plain `Array` instead may be result in better performance
where immutability is not needed.

Hmm, no:

...

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)

I am still somewhat disappointed though because I'd expect static Array to get close in performance to pre-allocated array of exact size over many iterations - which doesn't happen. Need to investigate.

Reply via email to