Skip to content

chore: benchmark with msgpack#881

Merged
liuq19 merged 1 commit intomainfrom
chore/benchmark
Nov 13, 2025
Merged

chore: benchmark with msgpack#881
liuq19 merged 1 commit intomainfrom
chore/benchmark

Conversation

@liuq19
Copy link
Copy Markdown
Collaborator

@liuq19 liuq19 commented Nov 6, 2025

benchmark results

➜  benchmark_test git:(chore/benchmark) SONIC_NO_ASYNC_GC=1  go test -v -run=none -bench=BenchmarkWithMsg -benchmem ./ 
goos: linux
goarch: amd64
pkg: github.com/bytedance/sonic/external_jsonlib_test/benchmark_test
cpu: AMD EPYC 9Y25 128-Core Processor               
BenchmarkWithMsgPackDecode_Generic_Sonic_JSON
BenchmarkWithMsgPackDecode_Generic_Sonic_JSON-256          26365         45059 ns/op       63213 B/op        315 allocs/op
BenchmarkWithMsgPackDecode_Generic_Msgpack
BenchmarkWithMsgPackDecode_Generic_Msgpack-256             30133         39647 ns/op       36725 B/op        688 allocs/op
BenchmarkWithMsgPackDecode_Binding_Sonic_JSON
BenchmarkWithMsgPackDecode_Binding_Sonic_JSON-256          59922         19710 ns/op       20537 B/op         25 allocs/op
BenchmarkWithMsgPackDecode_Binding_Msgpack
BenchmarkWithMsgPackDecode_Binding_Msgpack-256             53305         22616 ns/op       13136 B/op        206 allocs/op
BenchmarkWithMsgPackEncode_Generic_Sonic_JSON
BenchmarkWithMsgPackEncode_Generic_Sonic_JSON-256          98030         12223 ns/op        9820 B/op          2 allocs/op
BenchmarkWithMsgPackEncode_Generic_Msgpack
BenchmarkWithMsgPackEncode_Generic_Msgpack-256             68619         17696 ns/op       16581 B/op          9 allocs/op
BenchmarkWithMsgPackEncode_Binding_Sonic_JSON
BenchmarkWithMsgPackEncode_Binding_Sonic_JSON-256         237344          4880 ns/op        9851 B/op          2 allocs/op
BenchmarkWithMsgPackEncode_Binding_Msgpack
BenchmarkWithMsgPackEncode_Binding_Msgpack-256             96565         12427 ns/op       16468 B/op          9 allocs/op
PASS
ok      github.com/bytedance/sonic/external_jsonlib_test/benchmark_test 11.309s

@liuq19 liuq19 merged commit 8a732a3 into main Nov 13, 2025
36 checks passed
@liuq19 liuq19 deleted the chore/benchmark branch November 13, 2025 02:22
@analytically
Copy link
Copy Markdown

Encoding Performance: Sonic JSON wins decisively

  • Generic: 31% faster, 41% less memory, 78% fewer allocations
  • Binding: 61% faster, 40% less memory, 78% fewer allocations

Decoding Performance: Mixed

  • Generic: Msgpack 12% faster but 118% more allocations (688 vs 315)
  • Binding: Sonic 13% faster with 88% fewer allocations (25 vs 206)

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.

3 participants