Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There is a lot more memory traffic in the second version of the code. Your arithmetic operations are simple enough that they take almost no time compared to the memory operations. Specifically, your calls to multiply() and sum() cause extra memory writes and reads proportional to the size of your matrix.

In any situation where speed is most important, you need to be careful how much memory access you do.

There is a lot more memory traffic in the second version of the code. Your arithmetic operations are simple enough that they take almost no time compared to the memory operations. Specifically, your calls to multiply() and sum() cause extra memory writes and reads reads, proportional to the size of your matrix.

In any situation where speed is most important, you need to be careful how much memory access you do.