qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Stitcher <astitc...@redhat.com>
Subject Small performance issue
Date Fri, 15 Dec 2006 14:39:08 GMT
One more modest performance speed up (around 1.5%); unfortunately this
is in code generated by the java generator so I don't really know where
to start to fix this:

In the generated file:

BasicDeliverBody.h

The constructor for BasicDeliverBody uses string by value where it
should use it by constant reference,

I'm not sure if there any other implications of this change, but it's
worth doing here, and any other code just initialising string can do it
through a const reference to avoid an unnecessary copy.

[Incidentally I was surprised to see a bare "string" in a header file,
the name space must be polluted somewhere]

Andrew

viz:
> class BasicDeliverBody : virtual public AMQMethodBody
> {
> ...
>     BasicDeliverBody(ProtocolVersion version,
>         string consumerTag,
>         u_int64_t deliveryTag,
>         bool redelivered,
>         string exchange,
>         string routingKey
>         ) :
>         AMQMethodBody(version),
>         consumerTag(consumerTag),
>         deliveryTag(deliveryTag),
>         redelivered(redelivered),
>         exchange(exchange),
>         routingKey(routingKey)
>     { }
> ...
> }

should be:

class BasicDeliverBody : virtual public AMQMethodBody
{
...
    BasicDeliverBody(ProtocolVersion version,
        const string& consumerTag,
        u_int64_t deliveryTag,
        bool redelivered,
        const string& exchange,
        const string& routingKey
        ) :
        AMQMethodBody(version),
        consumerTag(consumerTag),
        deliveryTag(deliveryTag),
        redelivered(redelivered),
        exchange(exchange),
        routingKey(routingKey)
    { }
...
}



Mime
View raw message