[jboss-jira] [JBoss JIRA] (JGRP-2445) MessageBatch: removal on iteration is inefficient
Bela Ban (Jira)
issues at jboss.org
Tue Feb 4 07:22:06 EST 2020
[ https://issues.redhat.com/browse/JGRP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bela Ban updated JGRP-2445:
---------------------------
Description:
We oftentimes have iteration through a MessageBatch and removal, e.g.
{code:java}
for(Message msg: batch) {
if(condition)
batch.remove(msg);
}
}
{code}
This is inefficient for large batches, as {{MessageBatch.remove()}} iterates through the batch until it finds the message to be nulled.
It is more efficient to use {{BatchIterator.remove()}}.
Also include a {{BatchIterator.replace()}} method.
Pedro's code: [1] https://github.com/pruivo/JGroups/tree/t_msg_batch_iterator
was:
We oftentimes have iteration through a MessageBatch and removal, e.g.
{code:java}
for(Message msg: batch) {
if(condition)
batch.remove(msg);
}
}
{code}
This is inefficient for large batches, as {{MessageBatch.remove()}} iterates through the batch until it finds the message to be nulled.
It is more efficient to use {{BatchIterator.remove()}}.
Pedro's code: [1] https://github.com/pruivo/JGroups/tree/t_msg_batch_iterator
> MessageBatch: removal on iteration is inefficient
> -------------------------------------------------
>
> Key: JGRP-2445
> URL: https://issues.redhat.com/browse/JGRP-2445
> Project: JGroups
> Issue Type: Enhancement
> Reporter: Bela Ban
> Assignee: Bela Ban
> Priority: Major
> Fix For: 5.0, 4.2.0
>
>
> We oftentimes have iteration through a MessageBatch and removal, e.g.
> {code:java}
> for(Message msg: batch) {
> if(condition)
> batch.remove(msg);
> }
> }
> {code}
> This is inefficient for large batches, as {{MessageBatch.remove()}} iterates through the batch until it finds the message to be nulled.
> It is more efficient to use {{BatchIterator.remove()}}.
> Also include a {{BatchIterator.replace()}} method.
> Pedro's code: [1] https://github.com/pruivo/JGroups/tree/t_msg_batch_iterator
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list