In benchmarking some Java code on a Solaris SPARC box, I noticed that the first time I call the benchmarked function it runs EXTREMELY slowly (10x difference):
First | 1 | 25295.979 ms
Second | 1 | 2256.990 ms
Third | 1 | 2250.575 ms
Why is this? I suspect the JIT compiler, is there any wa...
Update: 2009-05-29
Thanks for all the suggestions and advice. I used your suggestions to make my production code execute 2.5 times faster on average than my best result a couple of days ago. In the end I was able to make the java code the fastest.
Lessons:
My example code below shows the insertion of primitive ints but the producti...
Disclaimer: I have looked through this
question and this question
but they both got derailed by small
details and general
optimization-is-unnecessary concerns.
I really need all the performance I
can get in my current app, which is
receiving-processing-spewing MIDI data
in realtime. Also it needs to scale up
as well...
Hi,
considering this example:
public static void main(final String[] args) {
final List<String> myList = Arrays.asList("A", "B", "C", "D");
final long start = System.currentTimeMillis();
for (int i = 1000000; i > myList.size(); i--) {
System.out.println("Hello");
}
final long stop = System.currentTimeMillis(...
First of all, this is not about the usefulness of microbenchmarks. I'm well aware of their purpose: Indicating performance characteristics and comparison in a very specific case to highlight a single aspect. Whether or not this should have any implications on your work is a different story.
A few years ago, someone (I think Heinz Kabutz...
For university I benchmark the influence of certain refactorings (e.g., inline class and replace inheritance with delegation) on performance. Although I use HotSpot 5 and 6 in interpreted mode (-Xint), the differences in performance between the refactored and the not refactored versions are very small (few milliseconds at best).
Therefo...