[jboss-jira] [JBoss JIRA] (JGRP-2007) Adapt code to use new Java 8 features
Johno Crawford (JIRA)
issues at jboss.org
Tue Jan 26 18:27:00 EST 2016
[ https://issues.jboss.org/browse/JGRP-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13154146#comment-13154146 ]
Johno Crawford commented on JGRP-2007:
--------------------------------------
Consider using the following pattern in hot path / high performance code areas instead of for loops.
{code}
final int size = futures.size();
for (int i = 0; i < size; i ++) {
futures.get(i).setFailure(cause);
...
{code}
using a for loop eg. for (ChannelFuture future : futures) { implicitly creates an Iterator, which will generate garbage to be collected. JIT's escape analysis should be able to get rid of it once it kicks in, but the first 10.000 iterations will get a penalty.
> Adapt code to use new Java 8 features
> -------------------------------------
>
> Key: JGRP-2007
> URL: https://issues.jboss.org/browse/JGRP-2007
> Project: JGroups
> Issue Type: Task
> Reporter: Bela Ban
> Assignee: Bela Ban
> Priority: Minor
> Fix For: 4.0
>
>
> E.g replace loops for forEach() etc
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list