PERF: improve resample perf
Merge pull request #7673 from sinhrks/minmax_perf

PERF: improve resample perf