improve performance of find_peaks.