You might be surprised at how much changing your for loops can be when accessing matrix data.
for(int i=0; i<10000; i++){
for(int j=0; j<10000; j++){
blah[j][i] = whatever(); // Column oriented is very slow.
}
}
for(int j=0; j<10000; j++){
for(int i=0; i<10000; i++){ // Very fast: We move row-wise now. With luck, this is SIMD-vectorized by your compiler.
blah[j][i] = whatever();
}
}
Test that out, and you'll see a major performance improvement.-----------
If someone is writing high performance code, the #1 goal is to be able to read your profiler's output. If you can't read what the profiler says (cache hits, TLB hits, memory stalls, etc. etc.) then you can't make sense of the data.
The PDF goes deeper than I'd personally go, but there's some concepts here that are absolutely necessary if you actually want to understand what a decent profiler gives you these days.