System programming in D (Was: The God Language)

so so at so.so
Fri Dec 30 17:59:04 PST 2011


On Sat, 31 Dec 2011 03:40:43 +0200, Iain Buclaw <ibuclaw at ubuntu.com> wrote:

> Take a pick of any examples posted on this ML.  They are far better
> fit to use as a test bed.  Ideally one that does number crunching and
> can't be easily folded away.

Well not them but another dummy function, i didn't think it would differ  
this much.

time ./test_inl

real    0m0.013s
user    0m0.007s
sys     0m0.003s
time ./test

real    0m7.753s
user    0m5.966s
sys     0m0.013s
time ./test_inl

real    0m0.013s
user    0m0.010s
sys     0m0.000s
time ./test

real    0m7.391s
user    0m5.960s
sys     0m0.017s
time ./test_inl

real    0m0.014s
user    0m0.007s
sys     0m0.003s
time ./test

real    0m7.582s
user    0m5.950s
sys     0m0.030s


real test() // test.d
real test() @inline // test_inl.d
{
	real a=423123, b=432, c=10, d=100, e=4045, f=123;
	a = a / b * c / d + e - f;
	b = a / b * c / d + e - f;
	c = a / b * c / d + e - f;
	d = a / b * c / d + e - f;
	e = a / b * c / d + e - f;
	f = a / b * c / d + e - f;
	a = a / b * c / d + e - f;
	b = a / b * c / d + e - f;
	c = a / b * c / d + e - f;
	d = a / b * c / d + e - f;
	e = a / b * c / d + e - f;
	f = a / b * c / d + e - f;
	a = a / b * c / d + e - f;
	b = a / b * c / d + e - f;
	c = a / b * c / d + e - f;
	d = a / b * c / d + e - f;
	e = a / b * c / d + e - f;
	f = a / b * c / d + e - f;
	return f;
}

void main()
{
	for(uint i=0; i<1_000_000_0; ++i)
		test();
}


More information about the Digitalmars-d mailing list