I need help with the performance of the following code. It does a memcpy on two dynamically allocated arrays of arbitrary size:
int main()
{
double *a, *b;
u
Surely if you are comparing the speed of initialise and copy to the speed of just copy, then the initialisation should be included in timed section. It appears to me you should actually be comparing this:
// Version 1
for(i=0; i
To this:
// Version 2
for(i=0; i
I expect this will see your 3x speed improvement drop sharply.
EDIT: As suggested by Steve Jessop, you may also want to test a third strategy of only touching one entry per page:
// Version 3
for(i=0; i