Re: Question about CPU caches and D context pointers

2014-02-18 Thread Dicebot
None of your buffers are on stack in both examples. As those are dynamic arrays you only get pointer + length as value and data itself resides on heap in some unknown location. It can be in cache too, of course, if it has been used actively, but it can't be verified based on this simple

Re: Question about CPU caches and D context pointers

2014-02-18 Thread Casper Færgemand
On Tuesday, 18 February 2014 at 08:11:04 UTC, Dicebot wrote: None of your buffers are on stack in both examples. As those are dynamic arrays you only get pointer + length as value and data itself resides on heap in some unknown location. That. struct S {} class C {} S[] s1; // fat pointer

Re: Question about CPU caches and D context pointers

2014-02-18 Thread Dicebot
On Tuesday, 18 February 2014 at 18:13:24 UTC, Casper Færgemand wrote: S[2] s2; // array of two structs, plus a length? Storing length is not needed for static arrays because it is known, well, statically. I tested some prime sieves both in C++ and D. They worked fastest with dynamic arrays

Re: Question about CPU caches and D context pointers

2014-02-18 Thread Etienne
On 2014-02-18 1:13 PM, Casper Færgemand shortt...@hotmail.com wrote: On Tuesday, 18 February 2014 at 08:11:04 UTC, Dicebot wrote: I tested some prime sieves both in C++ and D. They worked fastest with dynamic arrays with a size matching the L1 cache. I presume the instructions are located

Re: Question about CPU caches and D context pointers

2014-02-18 Thread Dicebot
On Tuesday, 18 February 2014 at 19:55:20 UTC, Etienne wrote: On 2014-02-18 1:13 PM, Casper Færgemand shortt...@hotmail.com wrote: On Tuesday, 18 February 2014 at 08:11:04 UTC, Dicebot wrote: I tested some prime sieves both in C++ and D. They worked fastest with dynamic arrays with a size

Question about CPU caches and D context pointers

2014-02-17 Thread Etienne
I've had his question at the back of my mind and I know it's probably related to back-end optimizations but I'm taking a chance to see if anyone knows anything. I know everything about how insignificant the speed difference may be, but keep in mind this is to further my low-level

Re: Question about CPU caches and D context pointers

2014-02-17 Thread Tobias Pankrath
On Tuesday, 18 February 2014 at 03:15:59 UTC, Etienne wrote: I'm sorry if the question seems complicated, I read everything Ulrich Drepper had to say in What every programmer should know about memory, and I still have a bit of a hard time visualizing the question myself. I am by far no