Optimized applyFromArray performance by reducing cloning calls