D speed compared to C++

Saaa empty at needmail.com
Tue Mar 18 18:11:00 PDT 2008


> If you really want to improve performance on C or C++, do it by profiling 
> your program, and optimize parts where it matters how fast you go.
>
> - simplify
> - remove unnecessary loops
> - hoist stuff out of loops as much as possible
> - iterate or recurse in ways that ease cache miss penalties
Could you elaborate on this? ^

> - iterate instead of recurse as much as possible
> - reduce if/else if/else || && as much as possible
Is this because of the obvious `less calculations is better`, or something 
else?

> - multiply by inverse instead of divide where possible
> - reduce calls to the OS where it's sensible
>

- don't allocate and then delete is you need a ~same amount of memory 
afterwards. 





More information about the Digitalmars-d mailing list