3 ms·
If you want to see the actual memory latency you can make the next access depend on the results of the previous. uint32_t checksum = 0; uint32_t prevRes = 0;
by petermcneeley 8y ago
If you want to see the actual memory latency you can make the next access depend on the results of the previous.
uint32_t checksum = 0;
uint32_t prevRes = 0;
for (int i = 0; i < 1000000; i++) {
unsigned offset = (rand32() ^ prevRes )& (TABLE_SIZE - 1);
prevRes = table_ints[offset];
checksum += prevRes ;
}
- abainbridge 8y agoYeah, I did that. It took 60ns per iteration, as long as the page table for the pages I was hitting was in cache.