I'm benchmarking with “Perf” (Linux, gcc).
When allocating memory:
point_1 = calloc (100000000, 16); //this takes nearly 1 second and perf find 27M transfers from RAM->CACHE and 1M from CACHE->RAM
This is OK.
But when trying to allocate two arrays:
point_1 = calloc (100000000, 16);
point_2 = calloc (100000000, 16);
//again, program takes nearly 1 second, 27M transfers RAM-CACAHE, 1M CACHE->RAM
It looks like, that second “calloc” (and all following) are behave like “malloc”. I'm using “gcc version 4.9.2 (Ubuntu 4.9.2-0ubuntu1~12.04) ”. Otherwise program works fine.
Is that behaving OK?
Here are some more tests and results:
Time for allocating of data structure 1: 0.976468
Perf: R:27M, W:1M
Time for allocating of data structure 1: 0.975402
Time for initialization of data structure 1 to value of 7: 0.296787
Perf: R: 52M, W: 26M
Time for allocating of data structure 1: 0.976034
Time for initialization of data structure 1 to value of 7: 0.313554
Time for allocating of data structure 2: 0.000031 <-- misbehaving
Perf: R: 52M, W:26M
Time for allocating of data structure 1: 0.975403
Time for initialization of data structure 1 to value of 7: 0.313710
Time for allocating of data structure 2: 0.000031 <-- misbehaving
Time for initialization of data structure 2 to value of 7: 0.809855
Perf: R:79M, W: 53M