[quote]I believe Shirazi has done such opcode micr0-benchmarking.
You might check his site as it soudsn like you have one of the rare projects (byte code generators) where this is actually useful information. Keep in mind though you’ll have to track it for changes over VM versions
[/quote]
Ok, long time learker, first posting. I can safely say that my partner in crime has not done this type of benchmarking. I normally do that level of benchmarking and the last time that I did this was in an attempt to validate some of the tips in our tips database. I can safely say that I could not see any precevable differences between either technique. Later on I discovered that the compiler may have “optimized” my benchmark for me… As the saying goes… beware the microbenchmark ;D I still do them and I believe that they are useful but man can you get stung really badly if you’re not careful.
For example, I almost blogged a 1.5 MBM that I did the other night I was in the middle of the write up and a I had a nagging question. So, I went back in and tried a twiddle with the benchmark only to discover that the alteration resulted in a 60% reduction in run time. Ran the benchmark baseline in the 1.4.2_04 only to see the same effect.
The bizzare thing is; the twiddle was the removal of a call to sleep that occured after a forced GC and these calls are made outside of the metered section of code! Furthermore, because I didn’t force a full GC at controlled points, it ran during the metered portion of the code.
I’m currently wondering if the thread priority has been set in XP such that it’s often interruped after sleeping. That said, I shutdown just about everything running on the machine before starting the benchmark (including explorer :))
While writing this, I finished a test in W2K only to discover that the effect appears to be absent. So it would seem that this effect is a JVM/XP interaction. :-/