More on "Component Programming"

Paulo Pinto pjmlp at progtools.org
Tue May 28 01:18:43 PDT 2013


On Tuesday, 28 May 2013 at 07:26:06 UTC, Sebastian Graf wrote:
> 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.

Even with NGEN or Mono -aot?


More information about the Digitalmars-d mailing list