<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb" -->

---
title: Cutting JSON Parsing CPU Cost in Go | daily.dev
description: A head-to-head benchmark of encoding/json, encoding/json/v2, jsoniter, easyjson, sonic, and gjson on the same ~2KB struct payload, measured on both Apple M5...
canonical: https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Cutting JSON Parsing CPU Cost in Go | daily.dev
og:description: A head-to-head benchmark of encoding/json, encoding/json/v2, jsoniter, easyjson, sonic, and gjson on the same ~2KB struct payload, measured on both Apple M5...
og:url: https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb
og:image: https://api.daily.dev/og/posts/CSPTMVfbB.png
og:image:alt: Cutting JSON Parsing CPU Cost in Go
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cutting JSON Parsing CPU Cost in Go

**[Awesome Go](https://daily.dev/sources/awego)** · 16 min read · 0 upvotes · 0 comments

## Summary

A head-to-head benchmark of encoding/json, encoding/json/v2, jsoniter, easyjson, sonic, and gjson on the same ~2KB struct payload, measured on both Apple M5 and an AMD EPYC VPS. easyjson wins both decode and encode outright due to zero reflection; sonic offers a modest 10-16% decode edge (not the

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://skoredin.pro/blog/golang/json-parsing-performance-go>

## Questions this post answers

### Is encoding/json in Go 1.27 using the new v2 implementation by default?

Yes, as of Go 1.27 the standard encoding/json package (json.Marshal/json.Unmarshal) is backed internally by the encoding/json/v2 engine by default. It is not opt-in; GOEXPERIMENT=nojsonv2 is the escape hatch back to the old v1-only implementation, and that opt-out is expected to be removed in a future release. Both APIs share the same underlying engine, so allocation counts are identical between them.

_Developers upgrading to Go 1.27 can track encoding/json internals changes like this on daily.dev._

### How much faster is easyjson than encoding/json for decoding structs in Go?

On a 2KB struct with 12 line items, a map field, and a time.Time field, easyjson decoded in roughly half the CPU time of encoding/json: 2.45µs vs 4.29µs on an Apple M5, and 7.39µs vs 11.96µs on an AMD EPYC VPS. This comes from code generation eliminating reflection entirely, even though allocation counts were nearly identical (46 vs 47 allocs).

_Teams choosing a JSON library for hot paths can compare these tradeoffs on daily.dev before picking one._

### Is bytedance/sonic actually 10x faster than encoding/json for JSON parsing in Go?

No, on a realistic 2KB payload sonic was only about 10% faster than encoding/json on decode on an Apple M5 and 16% faster on an AMD EPYC VPS, not the dramatic multiple its marketing implies. It also used considerably more memory per operation (6.64 KiB vs 3.03 KiB on the M5) and is limited to amd64 and arm64 architectures, falling back to encoding/json elsewhere.

_Developers evaluating sonic against encoding/json can weigh these numbers on daily.dev before switching._

## Similar posts on daily.dev

- [Simdjson Shows More Speed-Ups Possible For SIMD In JSON Parsing: Another 30% Boost](https://daily.dev/posts/simdjson-shows-more-speed-ups-possible-for-simd-in-json-parsing-another-30-boost-gm3xesadz) · Phoronix · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#golang](https://daily.dev/tags/golang)

[View this post on daily.dev](https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Cutting JSON Parsing CPU Cost in Go","url":"https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb"},"datePublished":"2026-09-10T20:31:00.436Z","dateModified":"2026-10-15T02:22:33.460Z","description":"A head-to-head benchmark of encoding/json, encoding/json/v2, jsoniter, easyjson, sonic, and gjson on the same ~2KB struct payload, measured on both Apple M5...","image":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","thumbnailUrl":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","isAccessibleForFree":true,"articleSection":"Awesome Go","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Awesome Go","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/awego","url":"https://daily.dev/sources/awego"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,golang","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Awesome Go","item":"https://daily.dev/sources/awego"},{"@type":"ListItem","position":3,"name":"Cutting JSON Parsing CPU Cost in Go"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/cutting-json-parsing-cpu-cost-in-go-csptmvfbb#faq","mainEntity":[{"@type":"Question","name":"Is encoding/json in Go 1.27 using the new v2 implementation by default?","acceptedAnswer":{"@type":"Answer","text":"Yes, as of Go 1.27 the standard encoding/json package (json.Marshal/json.Unmarshal) is backed internally by the encoding/json/v2 engine by default. It is not opt-in; GOEXPERIMENT=nojsonv2 is the escape hatch back to the old v1-only implementation, and that opt-out is expected to be removed in a future release. Both APIs share the same underlying engine, so allocation counts are identical between them. Developers upgrading to Go 1.27 can track encoding/json internals changes like this on daily.dev."}},{"@type":"Question","name":"How much faster is easyjson than encoding/json for decoding structs in Go?","acceptedAnswer":{"@type":"Answer","text":"On a 2KB struct with 12 line items, a map field, and a time.Time field, easyjson decoded in roughly half the CPU time of encoding/json: 2.45µs vs 4.29µs on an Apple M5, and 7.39µs vs 11.96µs on an AMD EPYC VPS. This comes from code generation eliminating reflection entirely, even though allocation counts were nearly identical (46 vs 47 allocs). Teams choosing a JSON library for hot paths can compare these tradeoffs on daily.dev before picking one."}},{"@type":"Question","name":"Is bytedance/sonic actually 10x faster than encoding/json for JSON parsing in Go?","acceptedAnswer":{"@type":"Answer","text":"No, on a realistic 2KB payload sonic was only about 10% faster than encoding/json on decode on an Apple M5 and 16% faster on an AMD EPYC VPS, not the dramatic multiple its marketing implies. It also used considerably more memory per operation (6.64 KiB vs 3.03 KiB on the M5) and is limited to amd64 and arm64 architectures, falling back to encoding/json elsewhere. Developers evaluating sonic against encoding/json can weigh these numbers on daily.dev before switching."}}]}
```

