perf: remove unnecessary clones in a hot path (#3580)