felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe Marschall (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-4819) Use Set instead of List for cycle detection
Date Sun, 05 Apr 2015 12:37:33 GMT

    [ https://issues.apache.org/jira/browse/FELIX-4819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14396207#comment-14396207

Philippe Marschall commented on FELIX-4819:

Indeed it does. I'll close as a duplicate.

> 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

View raw message