On Friday, 29 May 2015 at 07:51:31 UTC, thedeemon wrote:
On Thursday, 28 May 2015 at 21:23:11 UTC, Momo wrote:

Ah, actually it's more complicated, as it depends on inlining a lot.
Yes. And real functions are more complex and inlining is no reliable option.
Indeed, without -O and -inline I was able to get by_ref to be slightly slower than by_copy for struct of 4 ints. But when inlining turns on, the numbers change in different directions. And for 5 ints inlining influence is quite different:

4 ints:             5 ints:
-release
by ref: 53          by ref: 53
by copy: 57         by copy: 137
by move: 54         by move: 137

-release -O
by ref: 38          by ref: 34
by copy: 54         by copy: 137
by move: 49         by move: 137

-release -O -inline
by ref: 15          by ref: 20
by copy: 72         by copy: 91
by move: 72         by move: 91

So as you can see, it is 2-3 times slower. Is there an alternative?

Reply via email to