If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
RAM Latency Confusion
I wrote a program to measure the "end to end" latency
for reading a random 32-bit word in RAM. Basically, it works like this: 1. It creates a circular list of pointers in memory in which each pointer points at random to another pointer in the list. The list occupies 256MB of memory. 2. Then, by iterating through the list, the program computes the time required to execute the instruction, "mov edi, [edi]". When I run the program, the time I'm getting is about 230 nanoseconds, which, on my computer translates to 23 CPU cycles. My computer has an MSI 694T Pro mainboard, a 1GHz PIII Celeron CPU, 100MHz FSB, and 512MB PC133 CL2 ECC RAM set to run at 133MHz. According to SiSoft Sandra, its performance is right in line with similar configurations. I have the RAM set to "turbo" in the BIOS, which I believe sets the RAM timings to 2-1-1-1, which would mean that it should take 5 cycles to read in a (32 byte) cache line. (Each random access as described above would pull in a cache line.) Why am I measuring 23 cycles? What part of "RAM latency" don't I understand?? -- Bob Day |
#2
|
|||
|
|||
On Sat, 27 Sep 2003 20:51:20 GMT, "Bob Day"
wrote or quoted : Why am I measuring 23 cycles? What part of "RAM latency" don't I understand?? One thing you want to do is cycle the ram at least once before you start timing to make sure there is no virtual ram paging overhead or allocation overhead. -- Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary. |
#3
|
|||
|
|||
"Roedy Green" wrote in message ... On Sat, 27 Sep 2003 20:51:20 GMT, "Bob Day" wrote or quoted : Why am I measuring 23 cycles? What part of "RAM latency" don't I understand?? One thing you want to do is cycle the ram at least once before you start timing to make sure there is no virtual ram paging overhead or allocation overhead. Thanks, Roedy. I put in a loop to iterate through the random pointer list 100,000 times before starting the timing. It didn't lower the number of cycles I'm measuring to access a random location by much (it's now an average of 22.5), but it did make the measurements significantly more consistent from run to run (I'm getting numbers like 22.528, 22.535, and 22.522). But still, I don't understand why it's not around 5 cycles plus maybe a few cycles for the mov instruction itself. -- Bob Day |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cas latency among the same speed RAM modules | [email protected] | General | 1 | July 18th 03 10:51 PM |
RAM Latency | MiniDisc_2k2 | General | 1 | July 2nd 03 05:16 PM |