Here is an article for specialists developing API or performing slow code refactoring. All the code given in the article is test code, but it reflects the main points of real code.
This material is aimed at writing benchmarks covering parts of the application code from the inside. To fine-tune the performance of the entire application, you need people with the appropriate competencies.
Follow the link and read the article.