Hi Dhammika,

>diff --git a/src/ctx.cpp b/src/ctx.cpp
>index 2660e1f..267f7d0 100644
>--- a/src/ctx.cpp
>+++ b/src/ctx.cpp
>@@ -64,7 +64,8 @@ zmq::ctx_t::ctx_t (uint32_t io_threads_) :
>     }
>
>     //  In the unused part of the slot array, create a list of empty slots.
>-    for (uint32_t i = slot_count - 1; i >= io_threads_; i--) {
>+    for (int32_t i = (int32_t) slot_count - 1;
>+          i >= (int32_t) io_threads_; i--) {
>         empty_slots.push_back (i);
>         slots [i] = NULL;
>     }
>
>Is there a special reason to count down from slot_count - 1?
>Why not count up from io_threads to i < slot_count?
>I posted attached patch few days back but it didn't make it.

Sorry for not responding back then. The reason for counting backwards is
to get the slots at the beginning of the list to be used first. Right
now there is only one almost irrelevant performance improvement (one
pagefault less... maybe), however, in the future, when ints will be used
to identify sockets instead of void*'s, it will be desirable to start
with smallest numbers as all POSIX implementations already do with file
descriptors.

Martin
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to