Performance improvements for D / DMD compiler.
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Fri Jan 19 19:47:32 PST 2007
Christian Kamm wrote:
>> What's on your wish-list (let's leave the GC and other library
>> functionality out of this for now <g>)?
>
> I'd like to see unneccessary copies being optimized away, especially of
> large structs passed to functions. The workaround
>
> // use inout to pass s by reference, it is not actually modified
> void foo(inout LargeStruct s)
>
> is just abusing inout. In my opinion it should be an in parameter and D
> should detect whether a copy is neccessary or not.
>
> It's not done already, is it?
No, and for a good reason:
foo(LargeStruct s1, LargeStruct s2)
{
...
}
...
LargeStruct s;
foo(s, s);
Nobody would enjoy hidden aliasing of s1 and s2.
Andrei
More information about the Digitalmars-d
mailing list