[ https://issues.apache.org/jira/browse/MYFACES-3130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16125689#comment-16125689 ]
Thomas Andraschko commented on MYFACES-3130: -------------------------------------------- I would close this one. All loops are looking good now. > [PERF] Avoid unnecessary AbstractList$Itr instances > --------------------------------------------------- > > Key: MYFACES-3130 > URL: https://issues.apache.org/jira/browse/MYFACES-3130 > Project: MyFaces Core > Issue Type: Improvement > Components: JSR-314 > Environment: myfaces core trunk > Reporter: Martin Kočí > Assignee: Martin Kočí > Fix For: 2.3.0 > > Attachments: MYFACES-3130-example.patch, MYFACES-3130-part2.patch, > UIViewRoot-MYFACES-3130.patch > > > Similar issue: MYFACES-3129 > loop from java 5: > for (Object object: objects) > creates new instance of AbstractList$Itr, if objects are instance of > ArrayList. > Similar situation is with explicit .iterator() call. > In my testcases, it is about ~ 100 000 instances per request/response. > Creation itself is cheap, but triggers GC lately. > I suggest to use old index-style for (i = 0; i < childCount; i++) if > possible. Are there any rawbacks of index-based iteration? > Children is List and as implementation detail we know that it is instance of > ArrayList. -- This message was sent by Atlassian JIRA (v6.4.14#64029)