activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: ActiveMQ CPP: Getting text from a Text Message without making temporary
Date Mon, 13 Feb 2012 22:43:32 GMT
On Mon, 2012-02-13 at 14:26 -0800, stephenju wrote: 
> Just went through the source files and find it actually makes 4 copies of the
> text.
> 
> MarshallingSupport::readString32() makes 1 from the stream.
> ActiveMQTextMessage::getText() then make another one to store in its data
> member. Then it makes yet another one as return value. Finally, the
> assignment in my code makes one for itself.
> 
> Maybe I count them wrong? :)
> 
C++ String object uses a reference counted design so the copies are
lightweight copies internally they all point to the same data until a
mutating operation is performed.  Most modern compilers will also
optimize the return by using RVO and NRVO to eliminate the use of a
temporary.

> --
> View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-CPP-Getting-text-from-a-Text-Message-without-making-temporary-tp4384039p4385547.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Mime
View raw message