basically little observation made when accessing arrays out of sequence. i had inside isr, , affected performance worse. found pretty strange code little bit of isr. tried have array element 2 @ top (not important @ of course). code: [select] for ( int x=0 ; x<4 ; x++ ) { for ( int y=0 ; y<4 ; y++ ) { int cx = x+1; int cy = y+1; int fivecy = 4 - y; // 5-cy face[2][x][y] = cube[cx][fivecy][0]; // top (face 2) face[0][x][y] = cube[5][cx][cy]; face[1][x][y] = cube[cx][0][cy]; face[3][x][y] = cube[0][cx][fivecy]; face[4][x][y] = cube[fivecy][5][5-cx]; face[5][x][y] = cube[cx][cy][5]; // bottom (face 5) } } putting in sequence made faster again. thought wouldn't matter, guess compiler optimizations when arrays accessed in sequence? i have since optimized isr ~40% latency, these 2 versions (array in sequence vs out-of-sequence), had latency of 53 timer2 clock cycles (86% latency) , (see...
Comments
Post a Comment