Re: drastic slowdown for copies

2015-05-29 Thread Momo via Digitalmars-d-learn
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

Re: drastic slowdown for copies

2015-05-29 Thread Momo via Digitalmars-d-learn
Perhaps you can give me another detailed answer. I get a slowdown for all parts (ref, copy and move) if I use uninitialized floats. I got these results from the following code: by ref: 2369 by copy: 2335 by move: 2341 Code: struct vec2f { float x; float y; } But if I assign 0 to

drastic slowdown for copies

2015-05-28 Thread Momo via Digitalmars-d-learn
I'm currently investigating the difference of speed between references and copies. And it seems that copies got a immense slowdown if they reach a size of = 20 bytes. In the code below you can see if my struct has a size of 20 bytes (e.g. 4 ints = 16 bytes) a copy is cheaper than a reference.

Re: drastic slowdown for copies

2015-05-28 Thread Momo via Digitalmars-d-learn
On Thursday, 28 May 2015 at 21:27:42 UTC, Adam D. Ruppe wrote: 16 bytes is 64 bit - the same size as a reference. So copying it is overall a bit less work - sending a 64 bit struct is as small as a 64 bit reference and you don't go through the pointer. So up to them, it is a bit faster.