Damien Guard 3/22/2022

Estimating JSON size

Read Original

This technical article discusses the challenge of estimating JSON size for large object graphs in message queuing systems (like RabbitMQ via MassTransit) to optimize memory usage and GC pressure. It presents two .NET/C# solutions: a 100% accurate LengthOnlyStream class that tracks size during serialization, and a faster, less accurate JsonEstimator static class that approximates size by analyzing object types.

Estimating JSON size

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week