System programming in D (Was: The God Language)
so
so at so.so
Fri Dec 30 16:48:37 PST 2011
On Fri, 30 Dec 2011 20:48:54 +0200, Walter Bright
<newshound2 at digitalmars.com> wrote:
> On 12/30/2011 7:06 AM, so wrote:
>> I agree @inline (which will probably be an extension) in D should mean
>> force-inline.
>> Ignoring the impossible-to-inline cases (which in time should get
>> better),
>> adding @inline is a few minutes of editing.
>> It will just bypass the cost function and if it is not possible to
>> inline, pop
>> error.
>
>
> Sure, but I think you'll be very disappointed in that it isn't going to
> deliver the goods.
dmd_inl -O -inline test.d
dmd_inl -O -inline test_inl.d
time ./test
real 0m4.686s
user 0m3.516s
sys 0m0.007s
time ./test_inl
real 0m1.900s
user 0m1.503s
sys 0m0.007s
time ./test
real 0m4.381s
user 0m3.520s
sys 0m0.010s
time ./test_inl
real 0m1.955s
user 0m1.473s
sys 0m0.037s
time ./test
real 0m4.473s
user 0m3.506s
sys 0m0.017s
time ./test_inl
real 0m1.836s
user 0m1.507s
sys 0m0.007s
time ./test
real 0m4.627s
user 0m3.523s
sys 0m0.003s
time ./test_inl
real 0m1.984s
user 0m1.480s
sys 0m0.030s
Just bypassing cost escape, I ll try some complex cases soon after i get
phobos working.
int test() // test.d
int test() @inline // test_inl.d
{
int i = 0;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
++i;
return i;
}
void main()
{
for(uint i=0; i<1_000_000_000; ++i)
test();
}
More information about the Digitalmars-d
mailing list