created benchmark method to calculate running time of code