[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic mutidimensional arrays

From: Benjamin Kowarsch
Subject: Re: Dynamic mutidimensional arrays
Date: Wed, 5 Apr 2023 18:00:24 +0900


On Wed, 5 Apr 2023 at 17:46, Fischlin Andreas <> wrote:
Have you actually looked at LgMatrices? There is no such run time penalty from calling a procedure such as value(M, i,j). You simply write e.g.

     val := A^[i]^[k] * B^[k]^[j];

But that will lead to unnecessary cache misses because of multiple levels of indirection.

If you have such an _expression_ deeply nested in a loop, these cache misses will add up and significantly impact performance.

It is better to allocate all metadata (such as length of a vector) and payload data together in a single memory block. This is called data locality.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]