I am working on refactoring some Java code, so I'm going to adjust the time so that the code does not become slower. However, the new reorganized code seems to take longer than the source code. It is noteworthy that when I run the code with the profiler, the new code is much faster than the old code. The main difference is that the old code is recursive and the new iterative. Can the profiler affect the recursive code for several hundred thousand, and affecting iterative code only 1.5 times?
I work on Mac OS X 10.6.6, 3 GB of RAM, at 2.4 GHz, using the default Netbeans 6.9 profiler with a 64-bit Java 1.6.0__22 server.
(Both methods have self-synchronization code using System.currentTimeMillis () to allow me to compare times when the profiler is not used, but this should not noticeably affect things.)
source
share