Author: enrico-sorichetti
Subject: Reply to: Protection Exception while move 0 to comp-5 variables
Posted: Tue Oct 18, 2016 7:39 pm (GMT 5.5)
how arrays are defined and arranged in storage depend ONLY on the language and not on the environment ( computer/whatever architecture )
the ARRAY
can be stored in
Column-major order
e.g., Fortran, ...
Row-major order
e.g C/C++/Objective-C (for C-style arrays), Mathematica, PL/I, ...
<sparse> or whatever jargon the language uses
e.g Swift, Java, ...
the elements in the same row are contiguous (like row-major order),
but not the rows.
/soapbox on
for large arrays on ancient <systems> where the cache allcation was pretty primitive
( modulo <something> the real storage address IIRC )
accessing it in the wrong order
would put a lot of strain the cache
every inner index increment would cause a cache-frame fetch from storage
tested on an IBM 3090 200
just filling an array with zeroes
no work at all done for about 20 seconds
_________________
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort![icon_cool.gif]()
Subject: Reply to: Protection Exception while move 0 to comp-5 variables
Posted: Tue Oct 18, 2016 7:39 pm (GMT 5.5)
how arrays are defined and arranged in storage depend ONLY on the language and not on the environment ( computer/whatever architecture )
the ARRAY
Code: |
a11 a12 a13 a21 a22 a23 |
can be stored in
Column-major order
e.g., Fortran, ...
Code: |
a11 a21 a12 a22 a13 a23 |
Row-major order
e.g C/C++/Objective-C (for C-style arrays), Mathematica, PL/I, ...
Code: |
a11 a12 a13 a21 a22 a23 |
<sparse> or whatever jargon the language uses
e.g Swift, Java, ...
the elements in the same row are contiguous (like row-major order),
but not the rows.
/soapbox on
for large arrays on ancient <systems> where the cache allcation was pretty primitive
( modulo <something> the real storage address IIRC )
accessing it in the wrong order
would put a lot of strain the cache
every inner index increment would cause a cache-frame fetch from storage
tested on an IBM 3090 200
just filling an array with zeroes
no work at all done for about 20 seconds
_________________
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
