More on "Component Programming"
Sebastian Graf
SebastianGraf at t-online.de
Tue May 28 00:26:05 PDT 2013
On Tuesday, 28 May 2013 at 00:16:23 UTC, bearophile wrote:
> Sebastian Graf:
>
>> Plus, the compiler is still able to optimize most of the
>> delegate/range fluff away (as opposed to e.g. C#).
>
> There are several optimizations that D/DMD is not performing on
> those ranges and higher order functions. The Haskell compiler
> GHC optimized that stuff using purity, library defined "rewrite
> rules", stream fusion/deforestation and more. DMD does nothing
> of this, or very little. I think so far Walter has shown no
> interest in this.
>
Point taken, but what I actually meant was that the compiler is
allowed to optimize it all away in _theory_. You cannot have this
in C#, where filtering a
big array is faster with a foreach-if combination than with an
array.Where(predicate) linq statement (I blame the cache and
delegate indirection). Since there is no strong compile time
templating, this will not change in the future.
Of course this is a very specific case, but it is something you
have to keep in mind. The difference for some MB-sized arrays is
noticable.
TIL that GHC already has this. I should really continue learning
Haskell.
More information about the Digitalmars-d
mailing list