Passing array as const slows down code?

bearophile bearophileHUGS at lycos.com
Sat Apr 28 05:53:49 PDT 2012


Joseph Rushton Wakeling:

> ... because I found I got about a 2s speedup.  It's exactly the 
> speedup which was removed by adding "const" to the function 
> input, so I presume it's as you say, that this was implicitly 
> creating a local copy.

I suggest to take a look at the asm in both cases, and compare. 
Adding "const" doesn't cause local copies.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list