Book on low level program optimization




Can anybody recommend a book or a nice set of lecture notes on
lowlevel program optimization for numerical programs?

What is the cost of different mathematical operations? (addition
multiplication ect)

When is it harmful to place an if-then structure within a fast loop?

When is it harmful to make too many subroutine calls? (c++ allows me
to make "inline functions", but fortran does not. Does that make a
difference?)

I know that I can use a profiler such as gprof to answer some of these
questions myself, but I would prefer to read a good book.

Niels
.