Skip to content

Enhancement: Use Streams rather than Strings for Serialization

Mateusz Brawański requested to merge experimental/json-net-streams into master

Created by: Neuheit

Summary

Replaces JSON serialization/deserialzation of objects from strings to streams.

Details

This PR aims to optimize memory usage with JSON.net by passing it streams for deserialization rather than strings. This allows it to serialize parts of data at a time rather than the full string. I was only able to test this with a 10 shard bot, but I noticed a 50 MB reduction on memory usage on startup, which isn't much but is certainly an improvement. This should help the memory usage of larger bots.

Changes proposed

  • Convert rest client and api client to receive streams rather than strings
  • Convert WS to receive streams rather than strings

Merge request reports

Loading