DataOrientedDesign icon indicating copy to clipboard operation
DataOrientedDesign copied to clipboard

Rows vs Cols indexing

Open zahirtezcan-bugs opened this issue 3 years ago • 1 comments

Two dimensional array access should be similar to: array[(rowIndex * columnCount) + columnIndex]

But for example: https://github.com/badamczewski/DataOrientedDesign/blob/49c1a08606078737c85ec754ddfd90f5b25bbc17/DoDSamples/Samples/Benchmarks/RowsVsCols.cs#L33-L39

which is array[(columnIndex * columnCount) + rowIndex]

The results seem to be aligned with your course outline because one of them is using the outer loop index while other uses the inner loop. But that will need a fix when you have different column and row counts. It is useful to have different counts, if you want to keep the array size same and increase column size to see the effect of different levels of cache.

zahirtezcan-bugs avatar Mar 02 '21 10:03 zahirtezcan-bugs

You are right, I will update the sample.

badamczewski avatar Mar 08 '21 06:03 badamczewski