You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Niklas Gustavsson <ni...@protocol7.com> on 2009/09/01 09:04:09 UTC

Re: [vysper] cloning and forwarding stanzas

On Mon, Aug 31, 2009 at 7:40 PM,
bernd.fondermann<be...@brainlounge.de> wrote:
> Now there are convenience methods to replace 'to' and 'from' only in
>  StanzaBuilder.createForward(Stanza original, Entity from, Entity to)
> and
>  <T extends Stanza> T StanzaBuilder.createForwardStanza(
>                T original, Entity from, Entity to)

Great!

> I noticed that MUCMessageHandler's call to StanzaBuilder.createClone
> doesn't reuse the list in this way and re-creates it in the inner loop.
> We might want to change that.

We might. MUC is not optimized for performance (or much else besides
functionality) at this point. That being said, I'm not sure that
recreating the list is that much more expensive than reusing and
replacing.

/niklas

Re: [vysper] cloning and forwarding stanzas

Posted by Bernd Fondermann <bf...@brainlounge.de>.
Niklas Gustavsson wrote:
> On Mon, Aug 31, 2009 at 7:40 PM,
> bernd.fondermann<be...@brainlounge.de> wrote:
>> Now there are convenience methods to replace 'to' and 'from' only in
>>  StanzaBuilder.createForward(Stanza original, Entity from, Entity to)
>> and
>>  <T extends Stanza> T StanzaBuilder.createForwardStanza(
>>                T original, Entity from, Entity to)
> 
> Great!

Unfortunately, this signature is now

Stanza StanzaBuilder.createForwardStanza(Stanza original, Entity from,
Entity to)

since coercing into XMPPCoreStanza created another object (see
XMPPCoreStanza.createWrapper()) and is useless in the current contexts
using this methods.

> 
>> I noticed that MUCMessageHandler's call to StanzaBuilder.createClone
>> doesn't reuse the list in this way and re-creates it in the inner loop.
>> We might want to change that.
> 
> We might. MUC is not optimized for performance (or much else besides
> functionality) at this point. That being said, I'm not sure that
> recreating the list is that much more expensive than reusing and
> replacing.

memory-wise, if there are 100 participants in a room, you could easily
avoid creating 100 ArrayLists of size 10 for each message sent.

I know it's micro-optimization with no numbers behind it but my guts
tell me it will make a difference under heavy load. Anyway, just noted
it when I worked on createClone() and thought about replacing with
createForwardStanza()

  Bernd