Skip to content

feat: upgrade to Go 1.26 with GOEXPERIMENT=jsonv2#29

Open
Savid wants to merge 2 commits into
masterfrom
feat/go-1.26-jsonv2
Open

feat: upgrade to Go 1.26 with GOEXPERIMENT=jsonv2#29
Savid wants to merge 2 commits into
masterfrom
feat/go-1.26-jsonv2

Conversation

@Savid

@Savid Savid commented Feb 12, 2026

Copy link
Copy Markdown
Member

Bump Go from 1.25.1 to 1.26 and enable GOEXPERIMENT=jsonv2 across all build surfaces (Makefile, Dockerfile, goreleaser, CI) to leverage the jsonv2 encoding/json internals for faster marshal/unmarshal and reduced GC overhead via Green Tea GC.

Add JSON benchmarks targeting the hot-path logging operations to measure the impact on unmarshal, marshal indent, beautifyJSON, and the full request/response logging flow.

Benchmark results (Go 1.25.1 vs Go 1.26 GOEXPERIMENT=jsonv2):

JSONUnmarshal: ~4.0x faster across all sizes (283 -> 536 MB/s at 1KB, 421 -> 1679 MB/s at 5MB)
JSONMarshalIndent: ~3.2-3.5x faster, 35-45% less memory allocated
JSONLoggingFlow: ~3.1-3.7x faster end-to-end on the hot-path logging goroutines

  BenchmarkJSONUnmarshal (json.Unmarshal into any)
┌───────┬────────────────┬────────────────┬─────────┬─────────────┬─────────────┐
│ Size  │ master (ns/op) │ jsonv2 (ns/op) │ Speedup │ master MB/s │ jsonv2 MB/s │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 1KB   │ 3,587          │ 1,899          │ 1.9x    │ 283         │ 536         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 10KB  │ 29,888         │ 7,886          │ 3.8x    │ 342         │ 1,298       │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 50KB  │ 146,380        │ 37,017         │ 4.0x    │ 350         │ 1,386       │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 100KB │ 286,384        │ 70,395         │ 4.1x    │ 357         │ 1,455       │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 200KB │ 560,653        │ 138,729        │ 4.0x    │ 365         │ 1,477       │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 500KB │ 1,386,463      │ 336,266        │ 4.1x    │ 369         │ 1,524       │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 1MB   │ 2,652,409      │ 653,187        │ 4.1x    │ 395         │ 1,605       │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 2MB   │ 5,197,563      │ 1,285,093      │ 4.0x    │ 404         │ 1,632       │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 5MB   │ 12,456,402     │ 3,123,177      │ 4.0x    │ 421         │ 1,679       │
└───────┴────────────────┴────────────────┴─────────┴─────────────┴─────────────┘
BenchmarkJSONMarshalIndent (json.MarshalIndent)
┌───────┬────────────────┬────────────────┬─────────┬────────────────────┬────────────────────┐
│ Size  │ master (ns/op) │ jsonv2 (ns/op) │ Speedup │ master allocs B/op │ jsonv2 allocs B/op │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 1KB   │ 4,384          │ 2,170          │ 2.0x    │ 3,395              │ 2,305              │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 10KB  │ 35,517         │ 11,145         │ 3.2x    │ 31,438             │ 21,334             │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 50KB  │ 170,601        │ 50,155         │ 3.4x    │ 167,326            │ 115,264            │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 100KB │ 327,999        │ 96,719         │ 3.4x    │ 318,987            │ 213,921            │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 200KB │ 677,372        │ 192,376        │ 3.5x    │ 658,588            │ 427,862            │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 500KB │ 1,587,433      │ 469,489        │ 3.4x    │ 1,706,132          │ 1,038,289          │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 1MB   │ 3,066,970      │ 929,586        │ 3.3x    │ 3,471,988          │ 2,122,031          │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 2MB   │ 6,191,773      │ 1,860,290      │ 3.3x    │ 8,083,489          │ 4,240,718          │
├───────┼────────────────┼────────────────┼─────────┼────────────────────┼────────────────────┤
│ 5MB   │ 15,071,482     │ 4,727,588      │ 3.2x    │ 18,977,583         │ 10,533,844         │
└───────┴────────────────┴────────────────┴─────────┴────────────────────┴────────────────────┘
BenchmarkJSONLoggingFlow (full hot-path: ReadAll + beautifyJSON + Unmarshal)
┌───────┬────────────────┬────────────────┬─────────┬─────────────┬─────────────┐
│ Size  │ master (ns/op) │ jsonv2 (ns/op) │ Speedup │ master MB/s │ jsonv2 MB/s │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 1KB   │ 12,298         │ 6,836          │ 1.8x    │ 83          │ 149         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 10KB  │ 105,752        │ 34,502         │ 3.1x    │ 97          │ 297         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 50KB  │ 499,137        │ 155,263        │ 3.2x    │ 103         │ 330         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 100KB │ 997,197        │ 273,280        │ 3.6x    │ 103         │ 375         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 200KB │ 1,910,532      │ 544,787        │ 3.5x    │ 107         │ 376         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 500KB │ 4,630,326      │ 1,310,485      │ 3.5x    │ 111         │ 391         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 1MB   │ 9,113,348      │ 2,491,948      │ 3.7x    │ 115         │ 421         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 2MB   │ 17,892,704     │ 4,785,666      │ 3.7x    │ 117         │ 438         │
├───────┼────────────────┼────────────────┼─────────┼─────────────┼─────────────┤
│ 5MB   │ 42,270,560     │ 12,456,379     │ 3.4x    │ 124         │ 421         │
└───────┴────────────────┴────────────────┴─────────┴─────────────┴─────────────┘

@Savid Savid requested a review from pk910 as a code owner February 12, 2026 01:56
Bump Go from 1.25.1 to 1.26 and enable GOEXPERIMENT=jsonv2 across all
build surfaces (Makefile, Dockerfile, goreleaser, CI) to leverage the
jsonv2 encoding/json internals for faster marshal/unmarshal and reduced
GC overhead via Green Tea GC.

Add JSON benchmarks targeting the hot-path logging operations to measure
the impact on unmarshal, marshal indent, beautifyJSON, and the full
request/response logging flow.

Benchmark results (Go 1.25.1 vs Go 1.26 GOEXPERIMENT=jsonv2):

  JSONUnmarshal:    ~4.0x faster across all sizes (283 -> 536 MB/s at 1KB, 421 -> 1679 MB/s at 5MB)
  JSONMarshalIndent: ~3.2-3.5x faster, 35-45% less memory allocated
  JSONLoggingFlow:  ~3.1-3.7x faster end-to-end on the hot-path logging goroutines
@Savid Savid force-pushed the feat/go-1.26-jsonv2 branch from 96bff1a to f203177 Compare February 12, 2026 02:01
Signed-off-by: Barnabas Busa <busa.barnabas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants