This PR reduces allocations in a number of different areas and reduces the number of goroutines a single peer connection takes up by 1.
A worker pool is introduced to allow for the handling of multiple messages at once. The default number of workers is set to runtime.NumCPU().
No breaking changes were made in this PR.
aead: reuse buffers when possible and error if aead input is invalid
node, node/opts, client, conn: remove one unnecessary goroutine, add worker pool for pipelining incoming peer messages, allow configuring size of worker pool, and update docs
client: use single read buffer and write buffer, remove unnecessary bytes sent back/forth peers from handshake protocol logic, and simplify concurrency
msg: prevent allocs on marshal by allowing a byte buffer to be passed in
node: remove the need to resolve address every time a new connection is established to reduce allocs
node/opts, readme: set default max recv message size to 4mb, and update readme
id: copy host ip on unmarshal
This PR reduces allocations in a number of different areas and reduces the number of goroutines a single peer connection takes up by 1.
A worker pool is introduced to allow for the handling of multiple messages at once. The default number of workers is set to
runtime.NumCPU()
.No breaking changes were made in this PR.
aead: reuse buffers when possible and error if aead input is invalid node, node/opts, client, conn: remove one unnecessary goroutine, add worker pool for pipelining incoming peer messages, allow configuring size of worker pool, and update docs client: use single read buffer and write buffer, remove unnecessary bytes sent back/forth peers from handshake protocol logic, and simplify concurrency msg: prevent allocs on marshal by allowing a byte buffer to be passed in node: remove the need to resolve address every time a new connection is established to reduce allocs node/opts, readme: set default max recv message size to 4mb, and update readme id: copy host ip on unmarshal