optimized memory usage for peak locations