Smarter benchmark function