Home
Software
TIL
Contact Me
Benchmarking JSON vs TOON in Go
Since I’ve decided to use TOON instead of JSON, I’ve benchmarked the performance of serialization of 2 Go TOON libraries compared to JSON built-in serialization.
Here are the results using current version of the libraries and go 1.25:
% go run .
goos: darwin
goarch: arm64
pkg: bench_toon
cpu: Apple M3 Pro
BenchmarkJSONMarshalCompact-11    	 3488496	       322.3 ns/op
BenchmarkJSONMarshal-11           	  767379	      1546 ns/op
BenchmarkToonMarshal-11           	  669687	      1782 ns/op
BenchmarkGotoonEncode-11          	  161412	      7506 ns/op
PASS
ok  	bench_toon	5.143s
The libraries:
What we learned is:
What it means to me is that speed of TOON serialization in Go is not deal breaker. Program would have to spend most of the time serializing for the speed difference to matter.
til go programming json toon
Dec 15 2025

Home
Software
TIL
Contact Me