Similar to having unit tests for precise testing and functional tests for larger-scale testing of your code's correctness, you can use microbenchmarks and larger benchmarks to test your code's performance.
If you have tight constraints on the execution time for certain code paths, having a test that ensures the limit is met can be very useful. Even if you don't have such specific constraints, you might be interested in monitoring how the performance changes across code changes. If after a change your code runs slower than before by a certain threshold, the test could be marked as failed.
Although also a useful tool, remember that such tests are prone to the boiling frog effect: degrading the performance slowly over time can go unnoticed, so be sure to monitor the execution times occasionally. When introducing performance tests to your CI, be sure to always run them in the same environment for stable results.
Let's now discuss...