BLD: refactoring in test_perf