Ring buffers #12

Open
opened 2024-03-09 14:13:18 +01:00 by Jef Roosens · 0 comments

The read/write buffers for requests currently using memmove to move data to the front of the buffer, so the back can be reused for a subsequent read/write call. This works, but isn't the most efficient it can be, as it requires moving the data after every syscall.

An alternative to this would be using circular buffers. One disadvantage of this would be that syscalls could get split up into two (e.g. one read to fill the end of the array, then another to fill the part in front) but this performance decrease might not be too much of an issue, assuming the switch to circular buffers compensates for it. If we'd really like to go all out, we could instead start using recvmsg and sendmsg which can be instructed to write to multiple buffers. This way, we could write to the circular buffer using a single syscall.

The read/write buffers for requests currently using `memmove` to move data to the front of the buffer, so the back can be reused for a subsequent read/write call. This works, but isn't the most efficient it can be, as it requires moving the data after every syscall. An alternative to this would be using circular buffers. One disadvantage of this would be that syscalls could get split up into two (e.g. one read to fill the end of the array, then another to fill the part in front) but this performance decrease might not be too much of an issue, assuming the switch to circular buffers compensates for it. If we'd really like to go all out, we could instead start using `recvmsg` and `sendmsg` which can be instructed to write to multiple buffers. This way, we could write to the circular buffer using a single syscall.
Jef Roosens added the
enhancement
label 2024-03-09 14:13:18 +01:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Chewing_Bever/lnm#12
There is no content yet.