refactor performance.py