Steven Giesel 2/15/2023

A (performance) quirk with JsonSerializer

Read Original

This technical article investigates a performance issue in C#'s System.Text.Json.JsonSerializer. It demonstrates through benchmarks that creating a new JsonSerializerOptions instance for each serialization call, instead of reusing a static instance, leads to drastically increased execution time (3.84x slower) and memory allocation (3.04x more). The post explains the internal caching mechanism behind this behavior, providing insights for C# and .NET developers writing high-performance code.

A (performance) quirk with JsonSerializer

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

No top articles yet