You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladimir Ozerov (JIRA)" <ji...@apache.org> on 2017/07/10 07:08:08 UTC

[jira] [Updated] (IGNITE-2582) j.u.Collections.singletonIterator() allocations during TX cache puts.

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

Vladimir Ozerov updated IGNITE-2582:
------------------------------------
    Fix Version/s:     (was: 2.1)
                   2.2

> j.u.Collections.singletonIterator() allocations during TX cache puts.
> ---------------------------------------------------------------------
>
>                 Key: IGNITE-2582
>                 URL: https://issues.apache.org/jira/browse/IGNITE-2582
>             Project: Ignite
>          Issue Type: Task
>          Components: cache
>    Affects Versions: 1.5.0.final
>            Reporter: Vladimir Ozerov
>              Labels: performance
>             Fix For: 2.2
>
>
> *Problem*
> Allocations came from several sources:
> 1) IgniteTxManager.lockMultiple
> 2) IgniteTxManager.notifyEvictions
> 3) IgniteTxManager.removeObsolete
> 4) IgniteTxManager.unlockMultiple
> 5) GridDhtTxLocalAdapter.mapExplicitLocks
> In all these code pieces we have the same pattern: 
> {code}
> for (T t : collection) {
>     logic(t)
> }
> {code}
> *Solution*
> Perform simple refactoring:
> {code}
> if (collection isntanceof List) {
>     for (int i = 0; i < ((List)colllection).size()) {
>         logic(collection.get(i));
>     }
> }
> else {
>     for (T t : collection) {
>         logic(t)
>     }
> }
> {code}
> Though, we should be careful with LinkedList here - such refactoring will slowdown processing.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)