I am using Yourkit 8.0 to profile a mathematically intensive application running under Mac OS X (10.5.7, Apple JDK 1.6.0_06-b06-57) and have noticed some strange actions in the results of CPU profiling.
For example, I performed a profiling run using a sample survey that reported that 40% of applications in a 10-minute runtime were spent in the StrictMath.atan method. I found this perplexing, but I took it to that word and spent some time replacing the atan with an extremely simple polynomial approach.
When I started the application again, it took almost exactly the same time as before (10 minutes), but my replacement anan did not appear anywhere in the profiling results. Instead, the runtimes of other major hotspots simply increased to compensate for this.
Summarizing:
RESULTS With StrictMath.atan (native method)
Total lead time: 10 minutes
Method 1: 20%
Method 2: 20%
Method 3: 20%
StrictMath.atan: 40%
RESULTS With a simplified pure Java-atan
Total runtime: 10 minutes
Method 1: 33%
Method 2: 33%
Method 3: 33%
(Methods 1,2,3 do not make any atan calls)
, ? JProfiler EJ-Technologies. , API JDK , , OS X.