Add criterion benchmark
Optimize some operations