Wednesday, December 25, 2019

Computer Operation Times in Human Scale.

It's important to know the time scale of computers.In my experience programmers use random times for sleep, pause or retry - oh lets pause for a 1 second!! - thats small for us humans, thats a lot of time in Computer's time scale. 

Following table gives a sense of mapping from computer time scale to human time scale.
The table is from Peter Norvig's site (very popular): http://norvig.com/21-days.html#answers
The mapping is from Erik Meijer - Director of Engineering Facebook.


OperationTiming in Computer Time ScaleTiming in Human Time Scale
execute typical instruction1/1,000,000,000 sec = 1 nanosec  1 second 
fetch from L1 cache memory0.5 nanosec0.5 seconds
branch misprediction5 nanosec5 seconds
fetch from L2 cache memory7 nanosec7 seconds
Mutex lock/unlock25 nanosec0.5 minutes
fetch from main memory100 nanosec1.5 minutes
send 2K bytes over 1Gbps network20,000 nanosec5.5 hours
read 1MB sequentially from memory250,000 nanosec3 days
fetch from new disk location (seek)8,000,000 nanosec13 weeks
read 1MB sequentially from disk20,000,000 nanosec6.5 months
send packet US to Europe and back150 milliseconds = 150,000,000 nanosec5 year

No comments: