refactoring speed benchmark script