You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2015/03/11 17:25:39 UTC
[jira] [Commented] (FELIX-4819) Use Set instead of List for cycle
detection
[ https://issues.apache.org/jira/browse/FELIX-4819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14357126#comment-14357126 ]
Guillaume Nodet commented on FELIX-4819:
----------------------------------------
The latest code for FELIX-4656 actually includes this one.
> Use Set instead of List for cycle detection
> -------------------------------------------
>
> Key: FELIX-4819
> URL: https://issues.apache.org/jira/browse/FELIX-4819
> Project: Felix
> Issue Type: Improvement
> Components: Resolver
> Reporter: Philippe Marschall
> Labels: patch
> Attachments: ResolverImpl.java.patch
>
>
> We did some profiling of the Felix resolver in our application and 16% were spent in {{ArrayList#indexOf}} called by {{{{ArrayList#contains}}. It seems that {{ResolverImpl}} uses {{java.util.ArrayList}} for data structures on which it only calls {{#add}} and {{#contains}} with the latter being O(n). A {{java.util.HashSet}} is the appropriate data structure for such this use case.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)