problem: zeromq performance got worsen by some changes

This commit is contained in:
somdoron
2016-05-03 19:37:39 +03:00
parent 115e7de7d2
commit fca45921a8
3 changed files with 22 additions and 17 deletions

View File

@@ -192,10 +192,10 @@ void zmq::stream_engine_t::plug (io_thread_t *io_thread_,
if (options.raw_socket) {
// no handshaking for raw sock, instantiate raw encoder and decoders
encoder = new (std::nothrow) raw_encoder_t (options.sndbuf);
encoder = new (std::nothrow) raw_encoder_t (out_batch_size);
alloc_assert (encoder);
decoder = new (std::nothrow) raw_decoder_t (options.rcvbuf);
decoder = new (std::nothrow) raw_decoder_t (in_batch_size);
alloc_assert (decoder);
// disable handshaking for raw socket
@@ -374,12 +374,12 @@ void zmq::stream_engine_t::out_event ()
outpos = NULL;
outsize = encoder->encode (&outpos, 0);
while (outsize < (size_t) options.sndbuf) {
while (outsize < (size_t) out_batch_size) {
if ((this->*next_msg) (&tx_msg) == -1)
break;
encoder->load_msg (&tx_msg);
unsigned char *bufptr = outpos + outsize;
size_t n = encoder->encode (&bufptr, options.sndbuf - outsize);
size_t n = encoder->encode (&bufptr, out_batch_size - outsize);
zmq_assert (n > 0);
if (outpos == NULL)
outpos = bufptr;
@@ -576,10 +576,10 @@ bool zmq::stream_engine_t::handshake ()
return false;
}
encoder = new (std::nothrow) v1_encoder_t (options.sndbuf);
encoder = new (std::nothrow) v1_encoder_t (out_batch_size);
alloc_assert (encoder);
decoder = new (std::nothrow) v1_decoder_t (options.rcvbuf, options.maxmsgsize);
decoder = new (std::nothrow) v1_decoder_t (in_batch_size, options.maxmsgsize);
alloc_assert (decoder);
// We have already sent the message header.
@@ -623,12 +623,11 @@ bool zmq::stream_engine_t::handshake ()
return false;
}
encoder = new (std::nothrow) v1_encoder_t (
options.sndbuf);
encoder = new (std::nothrow) v1_encoder_t (out_batch_size);
alloc_assert (encoder);
decoder = new (std::nothrow) v1_decoder_t (
options.rcvbuf, options.maxmsgsize);
in_batch_size, options.maxmsgsize);
alloc_assert (decoder);
}
else
@@ -639,19 +638,19 @@ bool zmq::stream_engine_t::handshake ()
return false;
}
encoder = new (std::nothrow) v2_encoder_t (options.sndbuf);
encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
alloc_assert (encoder);
decoder = new (std::nothrow) v2_decoder_t (
options.rcvbuf, options.maxmsgsize);
in_batch_size, options.maxmsgsize);
alloc_assert (decoder);
}
else {
encoder = new (std::nothrow) v2_encoder_t (options.sndbuf);
encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
alloc_assert (encoder);
decoder = new (std::nothrow) v2_decoder_t (
options.rcvbuf, options.maxmsgsize);
in_batch_size, options.maxmsgsize);
alloc_assert (decoder);
if (options.mechanism == ZMQ_NULL