sample with copy optimization