ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ozerov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-2582) j.u.Collections.singletonIterator() allocations during TX cache puts.
Date Mon, 08 Feb 2016 09:28:39 GMT
Vladimir Ozerov created IGNITE-2582:
---------------------------------------

             Summary: 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: Sub-task
          Components: cache
    Affects Versions: 1.5.0.final
            Reporter: Vladimir Ozerov
             Fix For: 1.6


*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.3.4#6332)

Mime
View raw message