On Wed, 2018-11-28 at 10:55 -0800, Ryan Schmitt wrote:

...

> I wrote the benchmark to test the following perf claim (from
> HeaderGroup.java):
> 
>     // HTTPCORE-361 : we don't use the for-each syntax, when
> iterating headers
>     // as that creates an Iterator that needs to be garbage-collected
> 
> So far, every benchmark has demonstrated the opposite, that the
> Iterator is optimized out completely and creates zero GC pressure. To
> the extent that we are seeing throughput differences between the two
> implementations, I suspect that it has something to do with the
> concurrent modification checks in ArrayList's Iterator
> implementation;
> whether this trade-off is worthwhile is a separate discussion.
> 
> If you still feel really strongly about avoiding for-each syntax (at
> least with indexed collections), that's fine, but the above comment
> should at least be updated to reflect the benchmark data.
> 

Feel free to remove those comments. I generally dislike and disapprove
references to JIRA tickets in the source code. This is what commit
messages are for, wherein they refer to a specific issue within a
particular context at a particular point of time.

I am also not again for-each constructs per se, as long as they are not
being used for no reason, for instance, to replace perfectly valid
indexed access to ArrayList elements in performance critical areas of
code. 

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to