[zeromq-dev] STL use in zeromq

Pieter Hintjens ph at imatix.com
Fri Oct 29 13:36:04 CEST 2010


Mikael,

Yes, I'm remotely interested... :-)  If you can put the C++ test
programs somewhere (e.g. gist.github.com) I'll try them on a Linux box
and see what they give.  It's worth seeing what the relative
difference is for smaller vectors too.  Could turn out to be slower to
do erase-remove for smaller vectors.

Next step would be to identify a heavily used case in 0MQ, make the
change, and measure with real 0MQ load.

-Pieter

2010/10/29 Mikael Helbo Kjær <mhk at designtech.dk>:
> Hi
>
> I ran a test of the concepts as I described them (had to correct an
> issue that made microsofts STL go nuts over iterator invalidation as
> usual when erasing). And the erase-remove idiom is an order of
> magnitude faster. I am surprised at the great difference.
>
> On an average of just 10 runs (not enough to statistically relevant I
> know, but the values don't deviate a lot so...) the current zmq way of
> doing things takes ~50s to remove approximate 100000 values from a
> 1000000 vector of pseudo-random integer values.
>
> In the same situation with the same vector sizes the erase-remove idiom
> takes around 900 milliseconds.
>
> This test was done on a Core i7 64-bit Windows 7 with a binary produced
> by Visual Studio 2008. A VS2010 might have been faster as the STL there
> can or will soon use rvalue references to improve swap/move operations.
> I don't have a GCC test ready, but I could supply the short C++ unit
> test I implemented (edited slightly to remove the usage of my unit test
> framework and the like) if anyone is remotely interested.
>
> I am sure most vectors in 0mq are much much shorter than this but if
> there are places where there is a lot of incoming and outgoing messages
> maybe the erase-remove idiom might be useful there.
>
> Regards,
> Mikael
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>



-- 
-
Pieter Hintjens
iMatix - www.imatix.com



More information about the zeromq-dev mailing list