serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibIPC: Don't prepend message size in post_message

Open ADKaster opened this issue 2 years ago • 0 comments

In post_message, we copy the message buffer's data just to prepend a u32 size to it:

https://github.com/SerenityOS/serenity/blob/d3612216571f84e030cec675e0f05d297606edf7/Userland/Libraries/LibIPC/Connection.cpp#L63-L65

For large messages (looking at you LibWeb), this is a very expensive copy on each IPC message

We should reserve space at the front of the buffer and splat the size in just before sending.

ADKaster avatar Dec 19 '23 17:12 ADKaster