More perf testing and optimizations