Optimizations and benchmarking