From: Paolo Amoroso
Subject: Re: Timing for various operations on a PC
Date: 
Message-ID: <87wtjrz9ml.fsf@plato.moon.paoloamoroso.it>
········@gmail.com writes:

>     In Peter Norvig's essay, "Teach Yourself Programming in Ten Years",
> he says it is a good idea for anybody interested in CS to find out
> certain details like -- " Know how long it takes your computer to
> execute an instruction, fetch a word from memory (with and without a
> cache miss), read consecutive words from disk, and seek to a new
> location on disk." He gives a table(values from 2001) for his PC.
>     Can anyone tell me how to determine this accurately for a PC?

Jon Bentley explains how to do something similar in his books
"Programming Pearls" (see appendix 3 "Cost Models for Time and Space"
in the second edition) and "More Programming Pearls" (section 7.2
"Performance Rules of Thumb).


Paolo
-- 
Why Lisp? http://wiki.alu.org/RtL%20Highlight%20Film
Recommended Common Lisp libraries/tools:
- ASDF/ASDF-INSTALL: system building/installation
- CL-PPCRE: regular expressions
- CFFI: Foreign Function Interface
From: Paul Wallich
Subject: Re: Timing for various operations on a PC
Date: 
Message-ID: <dkaqe4$iie$1@reader2.panix.com>
Paolo Amoroso wrote:
> ········@gmail.com writes:
> 
> 
>>    In Peter Norvig's essay, "Teach Yourself Programming in Ten Years",
>>he says it is a good idea for anybody interested in CS to find out
>>certain details like -- " Know how long it takes your computer to
>>execute an instruction, fetch a word from memory (with and without a
>>cache miss), read consecutive words from disk, and seek to a new
>>location on disk." He gives a table(values from 2001) for his PC.
>>    Can anyone tell me how to determine this accurately for a PC?
> 
> 
> Jon Bentley explains how to do something similar in his books
> "Programming Pearls" (see appendix 3 "Cost Models for Time and Space"
> in the second edition) and "More Programming Pearls" (section 7.2
> "Performance Rules of Thumb).

Although many people have explained why this is now mostly impossible 
with modern CPU and memory architectures, even simpleminded versions of 
these experiments will give you some order-of-magnitude approximations 
that will be useful for back-of-the-envelope thinking. If you have an 
idea of which operations take nanoseconds versus microseconds versus 
milliseconds you'll be in much better shape than someone who doesn't. 
(And of course there are always the cases where the simple analysis is 
wrong, but that's what testing is for.)

paul