Optimize memory operations