If you put a known delay in your code, say 1ms for each layer of the cube, then you will get a known refresh rate, in this case 1000/8=125 refreshes per second. It won't be exactly that because of the execution time of the rest of your code, but it will be a reasonably good estimate.You can control the speed of animation better by giving the displayCube() function a parameter which is in milliseconds (instead of a count of refreshes required). For example displayCube(50) would repeat the 8ms refresh loop until 50ms had passed (so in practice it would be more like 56ms, having done 7 repeats).
You only need to do that 8 times to refresh the cube once, and only refresh the cube ~100 times per second to avoid flickering. So that's around 800 layer changes per second. Doing it more often, as your code is doing now, could make the ghosting worse.
What can happen is that when you trigger the latch line ("SS" in your code), not all the SRs update at exactly the same instant.
Really? How could that happen?