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 wrote: > Bytecode output courtesy of Mikael Ståldal: > > With standard loop: > > private static boolean contains(org.apache.logging.log4j.Marker, > org

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 run

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,

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 Andrew Haley
On 09/29/2014 05:31 PM, Vitaly Davidovich wrote: > I think Paul's email already has jmh output. Oh duh, sorry Paul. Andrew.

Re: Fwd: No for each loop comment?

2014-09-29 Thread Vitaly Davidovich
I think Paul's email already has jmh output. I looked at the generated asm on 7u60 x64 linux, and didn't see any material difference. Paul, have you or anyone else looked at the machine code diffs between the two? Looking at timing is useful, but it's possible to get caught up in noise; the gener

Re: Fwd: No for each loop comment?

2014-09-29 Thread Andrew Haley
On 09/29/2014 03:29 PM, Paul Benedict wrote: > 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 t

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