Passing array as const slows down code?

Era Scarecrow rtcvb32 at yahoo.com
Fri Apr 27 18:13:11 PDT 2012


On Saturday, 28 April 2012 at 00:04:05 UTC, Joseph Rushton 
Wakeling wrote:
> On 28/04/12 00:29, Era Scarecrow wrote:
>> At the off chance it's shallow copying, this should remove 
>> that.
>
> Ahhh, that works.  Thank you!
>
> ... 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.

  Well glad you found it :) Probably the different 'type' made it 
force a (useless) conversion while inside the template.

  Odd that the wrong answer was also the right answer :)


More information about the Digitalmars-d-learn mailing list