Don't play off the edge of the white keys, this is tempting for smaller hands because it is perceived as more comfortable. Keep the hand centred on the imaginary line on the keyboard where the black keys end, on pianos with ivory keytops there may actually be a visible line here. Diagram attached, play in the green highlighted area. This will help minimize in and out shifting, or moving the hand closer and farther away from the fallboard depending on whether one plays a white or black octave. This type of movement requires the pianist to do much more work, and in fast octave passages it can cause the playing mechanism to tire easily. A majority of the hand shifting should be focused on the lateral, left to right movement.
Just because it is written as an octave does not mean that the notes receive equal importance. If your hand shape requires, prioritize the more important note.
Think of the octaves as occurring in groups, rather than playing individual notes. Play a group, move the hand, play the next group, move the hand, and so on. Similar to the LH of this piece, where a group of six notes forms a broken chord. Form the hand correctly and one can reach most notes of the broken chord with minimal movement.