You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Brian Demers (JIRA)" <ji...@apache.org> on 2016/06/29 22:22:12 UTC

[jira] [Resolved] (SHIRO-566) CollectionUtils should use Collections wrappers of arrays if possible

     [ https://issues.apache.org/jira/browse/SHIRO-566?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Demers resolved SHIRO-566.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 1.3.0

> CollectionUtils should use Collections wrappers of arrays if possible
> ---------------------------------------------------------------------
>
>                 Key: SHIRO-566
>                 URL: https://issues.apache.org/jira/browse/SHIRO-566
>             Project: Shiro
>          Issue Type: Improvement
>          Components: Authorization (access control) 
>    Affects Versions: 1.2.4
>         Environment: Any
>            Reporter: Matt Bishop
>            Priority: Trivial
>             Fix For: 1.3.0
>
>
> org.apache.shiro.util.CollectionUtils.asSet() and .asList() could use Collections wrappers for the passed-in elements. These are smaller and faster than copying the contents into other collections.
> The editability of the returned Collections is not required as currently it will return either an unmodifiable emptyList() / emptySet() or a modifiable ArrayList / LinkedHashSet. Ideally it would wrap the LinkedHashSet in unmodifiableSet and declare the immutability of the returned collections in the docs.
> In my use case for Shiro we create about 6000 - 7000 WildcardPermission objects per second. The great majority of them have a a list of parts with single subparts and thus don't need a proper LinkedHashSet created. This change improve the performance of our system by 10% under heavy load, mostly due to the reduced GC of temporary LinkedHashSet objects. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)