Optimizations to remove memory allocations.