Re: Fwd: No for each loop comment?

2014-10-06 Thread Gary Gregory
FWIW, I've verified the same byte codes on Oracle Java 7 and 8 on Windows 7 (all 64 bit). Gary On Mon, Sep 29, 2014 at 1:58 PM, Paul Benedict pbened...@apache.org wrote: Bytecode output courtesy of Mikael Ståldal: With standard loop: private static boolean

Re: Fwd: No for each loop comment?

2014-10-03 Thread Chris Newland
Hi Paul, I've created a tool called JITWatch[1] which might be useful here. It parses the LogCompilation output, shows the source/bytecode/assembly and can highlight inlining failures due to exceeding the thresholds. If you could point me to the code you're having trouble with I'd be happy to

Fwd: No for each loop comment?

2014-09-29 Thread Paul Benedict
Open JDKers, I am forwarding an email to get some clarification. It's been a common understanding that foreach should perform no differently than the equivalent for-loop . However, some fellow developers claim there is a noticable difference in their microbenchmarking. Can you help explain what is

Re: Fwd: No for each loop comment?

2014-09-29 Thread Paul Benedict
Bytecode output courtesy of Mikael Ståldal: With standard loop: private static boolean contains(org.apache.logging.log4j.Marker, org.apache.logging.log4j.Marker...); Code: 0: iconst_0 1: istore_2 2: aload_1 3: arraylength 4: istore_3 5: iload_2

Re: Fwd: No for each loop comment?

2014-09-29 Thread Vitaly Davidovich
Bytecode isn't that interesting when discussing peak performance of jit'd code. Do you have assembly dumps? The only noteworthy aspect of the bytecode is that the enhanced for loop version is slightly bigger, and combined with other code in some method, may inhibit inlining. Speaking of which,