if statement faster than bitWrite?

As I don’t have an oscilloscope, I don’t have a way to know what is faster, this:

bitWrite(data[registerOfThisColumn], bitOfTheColumn, int(cubeMatrix[x][y][currentLayer]));
// Writes to the bit where is the led in the current layer to turn on a 1, or a 0 to turn off

Reads the value of an element 125 times per interrupt, 5000 times per second, and writes it

Or:

#define SET(x, y) (x |= (1 << y))
#define CLR(x, y) (x &= ~(1 << y))

if (cubeMatrix[x][y][currentLayer] == 1) {
  SET(data[registerOfThisColumn], bitOfTheColumn);
} else {
  CLR(data[registerOfThisColumn], bitOfTheColumn);          
}

Checks if the value is 1 or 0 and clears or sets that bit using my macros

I need this to refresh the image of a led cube, and at a good frequency, the main code runs fine, but when I change the duration of other layers (because I have some layers with more brighty leds), the fastest layers seem good but the slower have some flicker, so I wanted to make the refresh faster but now the code is being interrupted a lot more often, making it slower and loosing precision on the delay function of the animations.

Have you ever done this experiment?

you dont need an o/scope for this, there are noumerous programming ways you can see result. One of them :

put your version1 code in a loop . Each time cube refresh, a counter increases by 1. Run the "loop" for exactly the same time (let say 10 sec), serialprint the counter. put your version2 code in a loop...

Good idea! Thanks!

But, if you asked "what is the fastest way", then the answer would be :

see "direct port manipulation"