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

2
Designing Design Systems
TkDodo Dominik Dorfmeister 2 votes
4
Introducing RSC Explorer
Dan Abramov 1 votes
6
Fragments Dec 11
Martin Fowler 1 votes
7
Adding Type Hints to my Blog
Daniel Feldroy 1 votes
8
Refactoring English: Month 12
Michael Lynch 1 votes
10