Dynamic Closure + Lazy Arguments = Performance Killer?

bearophile bearophileHUGS at lycos.com
Fri Oct 24 15:52:19 PDT 2008


Jason House:

> 34% of the execution time is used by std.random.uniform.

Kiss of Tango is much faster, and there's a much faster still (but good still) rnd generator around...


> Can anyone verify that this is the case?

Can you show us a working minimal code I/we can test?

-------------------

Frank Benoit:

>The D2 full closure "feature" effectively removes it and makes D2 less attractive IMHO.<

The first simple solution is to add the possibility of adding "scope" to closures to not use the heap (but I don't know how to do that in every situation, and it makes the already long syntax of lambdas even longer).

But the probably best way for D to become more functional (and normal functional programming is often full of functions that move everywhere, often they are closures, but only virtually) is to grow some more optimizing capabilities, so closures aren't a problem anymore. There are many ways to perform such optimizations (but in a language mostly based on side effects it's less easy).

Bye,
bearophile



More information about the Digitalmars-d mailing list