grpc-mqtt icon indicating copy to clipboard operation
grpc-mqtt copied to clipboard

Perform packet serialization in place.

Open riz0id opened this issue 2 years ago • 1 comments

This PR changes Network.MQTT.GRPC.Message.Packet so that the same proto3-wire serialization buffer is reused after each packet is publish. This significantly reduces the maximum heap residency accumulated in the process of splitting a larger message into packets that are individually published.

Related:

  • Builds off previous changes #43, #37, and #42 improving performance and memory usage for packet publishes.
  • Depends on changes to proto3-wire exposing internal functions that were needed.

riz0id avatar Oct 26 '22 00:10 riz0id

The previous heap profile obtained from cabal v2-test --test-options "-p \"LongBytes\"" after the changes introduced by #42:

image

The new heap profile running the same "LongBytes" test:

image

riz0id avatar Oct 26 '22 00:10 riz0id