delay action on keypress to improve performance