On 12/22/10 8:16 PM, Andrei Alexandrescu wrote:
On 12/22/10 4:04 PM, Andreas Mayer wrote:
To see what performance advantage D would give me over using a
scripting language, I made a small benchmark. It consists of this code:

auto L = iota(0.0, 10000000.0);
auto L2 = map!"a / 2"(L);
auto L3 = map!"a + 2"(L2);
auto V = reduce!"a + b"(L3);

It runs in 281 ms on my computer.

Thanks for posting the numbers. That's a long time, particularly
considering that the two map instances don't do anything. So the bulk of
the computation is:

auto L = iota(0.0, 10000000.0);
auto V = reduce!"a + b"(L3);

Oops, I was wrong. The two instances of map do something, I thought they're all applied to L when in fact they are chained. So my estimates are incorrect. At any rate, clearly iota incurs a 2x cost, which probably composes with other similar costs incurred by map.

Andrei

Reply via email to