optimizations and benchmarks