Passing array as const slows down code?
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Fri Apr 27 08:33:39 PDT 2012
On 27/04/12 17:18, Steven Schveighoffer wrote:
> const should not affect code generation *at all*, except for name mangling
> (const MyStruct is a different type from MyStruct), and generating an extra
> TypeInfo for const MyStruct and const MyStruct[]. Const is purely a compile-time
> concept.
>
> This cannot account for an extra 2 seconds. Something else is happening.
>
> Without more of your code, nobody can give a definitive answer except it is not
> supposed to affect it.
The code is here: https://github.com/WebDrake/Dregs/
... and the particular file concerned is
https://github.com/WebDrake/Dregs/blob/master/dregs/codetermine.d
You'll see that there are about 8 different functions in there which receive as
input an array of type Rating!(UserID, ObjectID, Reputation)[]. These were the
inputs I was marking as const.
More information about the Digitalmars-d-learn
mailing list