Added benchmark.
Benchmarks and minor optimizations.