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

Optimize bytes copying after receiving a message from zmq #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hxzrx
Copy link

@hxzrx hxzrx commented May 30, 2023

The utility function unpack-foreign-msg-to-bytes uses cffi:foreign-array-to-lisp to copy zmq message to a lisp vector, this is very slow for large messages since cffi:foreign-array-to-lisp sets the lisp vector byte-to-byte in a loop.

In this PR, memcpy is used instead of cffi:foreign-array-to-lisp to copy zmq message to the lisp vector in one pass, and the result is very close to that of the C version of zmq.

@hxzrx hxzrx requested a review from a team as a code owner May 30, 2023 07:17
@stylewarning
Copy link
Contributor

This looks good and safe to me. MEMCPY will definitely be faster.

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