I wrote an API with 1000 lines of code. In code somewhere it's taking more time, so response time is increasing. I have two questions here
- How can I find the execution time of each line of the code?
- How can I identify code taking more time?
I wrote an API with 1000 lines of code. In code somewhere it's taking more time, so response time is increasing. I have two questions here
Profiling is what you are looking for, it basically shows you how often a given line of code is executed and how much time was spent in it (compared to other lines). This makes it easy to pinpoint the location where your code spends most of the time.
IntelliJ IDEA Ultimate has out-of-the-box support for profiling your applications using multiple Profilers.
Ref: https://blog.jetbrains.com/idea/2020/03/profiling-tools-and-intellij-idea-ultimate/