Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURVE: Reduce number of memory allocations and message copies #3805

Merged
merged 6 commits into from
Feb 4, 2020

Conversation

sigiesec
Copy link
Member

@sigiesec sigiesec commented Feb 3, 2020

I did a few runs on my desktop machine and average throughput via TCP loopback increases from ca. 5800 MB/s to 6100 MB/s for a 10k message size. Not statistically validated, but seems promising.

As a follow-up to this, performance can still be further optimised as discussed by saving one remaining extra memory allocation and copy on the encoding side, and by saving one copy on the decoding side.

Solution: change to conform with naming convention
Solution: extract into separate class curve_encoding_t
Solution: add initial tests
Solution: add CMake option WITH_LIBSODIUM_STATIC
…pying of message data

Solution: use crypto_box_easy_afternm and crypto_box_open_easy_afternm
in-place
@bluca bluca merged commit 06bdebf into zeromq:master Feb 4, 2020
@bluca
Copy link
Member

bluca commented Feb 4, 2020

build with libsodium 1.0.0 on debian 8 now fails:

[  171s] src/curve_mechanism_base.cpp: In member function 'int zmq::curve_encoding_t::encode(zmq::msg_t*)':
[  171s] src/curve_mechanism_base.cpp:159:61: error: 'crypto_box_easy_afternm' was not declared in this scope
[  171s]        &message_plaintext[0], mlen, message_nonce, _cn_precom);
[  171s]                                                              ^
[  171s] src/curve_mechanism_base.cpp: In member function 'int zmq::curve_encoding_t::decode(zmq::msg_t*, int*)':
[  171s] src/curve_mechanism_base.cpp:213:65: error: 'crypto_box_open_easy_afternm' was not declared in this scope
[  171s]                                         message_nonce, _cn_precom);

https://build.opensuse.org/package/live_build_log/network:messaging:zeromq:git-stable/libzmq/Debian_8.0/x86_64

@sigiesec sigiesec deleted the curve-zerocopy branch February 4, 2020 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants