An efficient high-order compact finite difference method for the Helmholtz equation