shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SHIRO-566) CollectionUtils should use Collections wrappers of arrays if possible
Date Mon, 30 May 2016 17:50:12 GMT

    [ https://issues.apache.org/jira/browse/SHIRO-566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15306846#comment-15306846
] 

ASF GitHub Bot commented on SHIRO-566:
--------------------------------------

GitHub user mattbishop opened a pull request:

    https://github.com/apache/shiro/pull/19

    SHIRO-566 Use Collections wrappers to save memory and cpu.

    See https://issues.apache.org/jira/browse/SHIRO-566 for details

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mattbishop/shiro SHIRO-566

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/shiro/pull/19.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #19
    
----
commit ed3a61538ebd776023168405befada19fe6e35ac
Author: Matt Bishop <matthew.bishop@elasticpath.com>
Date:   2016-05-30T17:47:28Z

    SHIRO-566 Use Collections wrappers to save memory and cpu.

----


> 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
>
> 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 single subpart and 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)

Mime
View raw message