How to measure performance in Java developement

前端 未结 7 1316
温柔的废话
温柔的废话 2020-12-10 16:13

Is there any tool can measure execution time for each function call and find out bottle neck for a given developing java j2se project? Thanks!

7条回答
  •  甜味超标
    2020-12-10 16:49

    Measuring is fine, but is a very indirect way to find bottlenecks. A very direct way is this: just hit ctrl-break several times, and examine the thread stacks.

    Any bottleneck will be a line of code, nearly always a function call, and it will appear often on the stack of some thread. The worse it is, the more often it will appear.

    Just look for any such often-appearing line of code. If you can figure out how to call it less, or not at all, you will save a bundle of time, guaranteed. Here's why.

提交回复
热议问题