Re: Fast access multi-dimensional arrays? (int type)



Kevin wrote:
Hi all,
I have a question of: is there any way we can create a
multi-dimensional arrays data structure, each grid item is a "int",
with fast access for operations like "increase value in one grid", or
get that value?

Does the total matrix size fit easily in cache? If you have only a two-dimensional problem, with 4 to 10 elements in each dimension, obviously the problem does fit.

If yes, then index arithmetic is probably the place to look for
improvements.

If no, then you need to think of your problem in terms of transfers
between memory and cache. Relationships between the order of access in
loops and the order of placement in memory matter. Generally, you want
the innermost loop to scan the dimension that is consecutive in memory.

Patricia
.



Relevant Pages

  • Re: Binary data in multiple adjacent files
    ... Mapping it doesn't eat any working set except, possibly, for the ... It's not faulted into physical memory. ... You also get a whole "page fault cluster" faulted in. ... grid sections immediately north, south, northeast, northwest, southeast ...
    (comp.os.vms)
  • Re: Graphics - need to draw to the screen and then erase it
    ... (I used the words "memory DC" to search for them). ... > and then use lines to create a grid. ... So the user presses on the display with the stylus and a line ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Loading those huge CSVs.
    ... > a) use a TDrawgrid instead of a TStringgrid and use that as a virtual ... > grid would be able to display the first load of lines very fast, ... > you can use a number of tricks to cut down on memory use and load time. ...
    (borland.public.delphi.language.objectpascal)
  • Re: memory leak problem with arrays
    ... change the array as determined by the transition rules is never freed. ... Are you aware that slicing shares memory? ... a grid to do the automata calculations on, ... even though it's only a tiny slice of it. ...
    (comp.lang.python)
  • Out Of Memory
    ... Yes I am getting old but in this case it is a VB6 problem. ... I get an out of memory error. ... Not sure if the is some limit on the grid or VB6 in general. ... Would VB handle it better if I used string arrays? ...
    (microsoft.public.vb.general.discussion)