Timeline for Map square coordinates in matrix to flat array indices without hurting performance
Current License: CC BY-SA 3.0
        7 events
    
    | when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 16, 2017 at 19:45 | answer | added | Loki Astari | timeline score: 1 | |
| Oct 16, 2017 at 19:30 | comment | added | Loki Astari | @TomášZato: What makes you think there is a performance issue. | |
| Oct 16, 2017 at 18:31 | comment | added | Loki Astari | @TomášZato Incomputable is trying to describe another form of optimization. He wants to double the memory you use to try and reduce accesses speed. | |
| Oct 16, 2017 at 13:53 | comment | added | Incomputable | Transpose is when you swap columns and rows. So seems like no, since you will traverse only once. The last one is just precaution, may be you wanted to deploy it on some architecture where array are allocated in different order. It looks good already, if I got everything right. Also storing matrices as vector of vectors is not a good idea, if they are not resized. | |
| Oct 16, 2017 at 13:52 | comment | added | Tomáš Zato | 
        
            
    The matrix is just nested std::vector. Every square is only traversed once. At worst case, all possible squares in matrix are traversed. I'm not sure how to answer the rest of the questions.
        
     | 
|
| Oct 16, 2017 at 13:47 | comment | added | Incomputable | When you'll start going down wide matrices you'll get cache misses. How many times will you traverse like that? Is transposing and saving a copy worth it? Does the platform store matrices in row major order? | |
| Oct 16, 2017 at 12:02 | history | asked | Tomáš Zato | CC BY-SA 3.0 |