Let Go, Standard Library From Community

Sean Kelly sean at f4.ca
Fri Apr 20 11:58:43 PDT 2007


Stephen Waits wrote:
> Daniel Keep wrote:
>>
>> To be honest, I wouldn't know the most efficient way to return or pass
>> out a vector because I've never had any kind of grounding in the effects
>> of the various ways of doing it.  For instance: at what point does
>> passing by reference become faster than by value?
> 
> 10 second lesson on optimization:
> 
> * Memory access is slow.  Both reading and writing.  It's generally been 
> that way for a long time, and appears to be staying that way.
> 
> * Optimize what is slowest.

Optimizers (within the compiler) put a weird spin on some of these 
however, because they take care of most fine-grained optimizations 
automatically.  I think these are good things to keep in mind, but they 
are subordinate to what you mention below:

> * Know what's slowest by profiling.
> 
> * The largest gains generally come from larger algorithmic changes.


Sean



More information about the Digitalmars-d mailing list