activemq-issues 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] (ARTEMIS-710) Avoid inefficient iteration over Map
Date Wed, 31 Aug 2016 18:30:23 GMT

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

ASF GitHub Bot commented on ARTEMIS-710:
----------------------------------------

Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/745
  
    I measured it not long ago.. and it's not that bad :) especially when it's only called
once during the live of the server.
    
    
    but this is better.. I agree :)
    
    
    👍  thanks a lot


> Avoid inefficient iteration over Map
> ------------------------------------
>
>                 Key: ARTEMIS-710
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-710
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 1.4.0
>            Reporter: Martin Styk
>            Priority: Minor
>
> On few places in Artemis code, inefficient iteration over Map object is present. 
> Example 
> {code:java}
>   Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
>          for (Thread thread : threadMap.keySet()) {
>            StackTraceElement[] stack = threadMap.get(thread);
>            ....
> {code}
> To make it more efficient, we should use Map.Entry instead of getting keySet and than
finding corresponding value.
> Places where this could be changed
> * ScaleDownHandler#scaleDownDuplicateIDs
> * PostOfficeJournalLoader#recoverPendingPageCounters
> * ActiveMQTestBase#tearDown



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

Mime
View raw message