Added benchmark helper to ease benchmarking
Optimized code