Loop optimization

"Jérôme M. Berger" jeberger at free.fr
Fri May 14 14:14:45 PDT 2010


bearophile wrote:
> kai:
> 
>> I was scared off by the warning that D 2.0 support is experimental.
> 
> LDC is D1 still, mostly :-(
> And at the moment it uses LLVM 2.6.
> LLVM 2.7 contains a new optimization that can improve that code some more.
> 
> 
>> Good to know, thanks (thats actually a great feature for scientists!).
> 
> In theory D is a bit fit for numerical computations too, but there is lot of work to do still. And some parts of D design will need to be improved to help numerical code performance.
> 
> From my extensive tests, if you use it correctly, D1 code compiled with LDC can be about as efficient as C code compiled with GCC or sometimes a little more efficient.
> 
> -------------
> 
> Steven Schveighoffer:
>> In C/C++, the default value for doubles is 0.
> 
> I think in C and C++ the default value for doubles is "uninitialized" (that is anything).
> 
	That depends. In C/C++, the default value for any global variable
is to have all bits set to 0 whatever that means for the actual data
type. The default value for local variables and malloc/new memory is
"whatever was in this place in memory before" which can be anything.
The default value for calloc is to have all bits to 0 as for global
variables.

	In the OP code, the malloc will probably return memory that has
never been used before, therefore probably initialized to 0 too (OS
dependent).

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100514/d569e95d/attachment.pgp>


More information about the Digitalmars-d-learn mailing list