You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@karaf.apache.org by rovarga <gi...@git.apache.org> on 2017/09/26 17:05:38 UTC

[GitHub] karaf pull request #377: Clean up object duplication

GitHub user rovarga opened a pull request:

    https://github.com/apache/karaf/pull/377

    Clean up object duplication

    This series of patches are attempts to improve resolver memory usage, which we have
    observed to go up to ~2GB while performing a mass install of all OpenDaylight features.
    
    A large-ish part of this are duplicated Strings and Maps.

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

    $ git pull https://github.com/rovarga/karaf dup-objects

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

    https://github.com/apache/karaf/pull/377.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 #377
    
----
commit bf46b42362a4a35f3c35eb380ba18d8991505f59
Author: Robert Varga <ni...@hq.sk>
Date:   2017-09-26T14:40:38Z

    Clean SimpleFilter up
    
    Profiling OpenDaylight SFT has turned up large memory usage when
    a lot of features are created. Some of the memory wasted is in
    over-allocated ArrayLists, which are using default pre-allocation
    size.
    
    This patch uses Collections.singletonList() to hold NOT operation
    arguments and reduces pre-allocation for other compound operations
    to 2.
    
    Signed-off-by: Robert Varga <ni...@hq.sk>

commit 71b10223ba7c1cfc955eea11dd6f91d0f3304fa8
Author: Robert Varga <ni...@hq.sk>
Date:   2017-09-26T15:20:10Z

    Deduplicate common OSGi filter strings
    
    Based on a heap dump with a large number of features/bundles,
    5 strings have a large number of duplicates -- ~48K duplicate strings,
    wasting ~1.9MiB of memory.
    
    Create a small interning Map, which can normalize these, squashing
    a number of these duplicates.
    
    Signed-off-by: Robert Varga <ni...@hq.sk>

commit 427e9f23c9103db94fbb82e163cbef4eb7ed890b
Author: Robert Varga <ni...@hq.sk>
Date:   2017-09-26T15:54:02Z

    Improve ResourceBuilder's use of maps
    
    Do not instatiate an empty HashMap where Collections.emptyMap()
    does the same. Also reuse default directives map, now backed by
    a Collections.singletonMap().
    
    Signed-off-by: Robert Varga <ni...@hq.sk>

commit 975e9239336b050155f93b192d6ee626920cdb97
Author: Robert Varga <ni...@hq.sk>
Date:   2017-09-26T16:36:33Z

    Reuse empty SimpleFilter
    
    Rather than instantiating a new filter, use a precomputed constant.
    This eliminates constructor calls from outside of the package, allowing
    it be be hidden.
    
    Signed-off-by: Robert Varga <ni...@hq.sk>

----


---

[GitHub] karaf pull request #377: Clean up object duplication

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/karaf/pull/377


---