optimize swap_buffer function, do a word per step