Skip to content

dirkaholic/golang-config-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compare the performance of json vs. toml as config format using golang

This small setup aims to compare the usage of json vs. toml as a config for go related projects. For json the go built-in parser is used while for toml we use https://github.com/pelletier/go-toml.

Setup

go get https://github.com/pelletier/go-toml

Run benchmark

go test -bench=. -benchmem -benchtime=10s

Result

BenchmarkTomlConfig-8	  200000	     91145 ns/op	   12592 B/op	     349 allocs/op
BenchmarkJsonConfig-8	 1000000	     16829 ns/op	    1320 B/op	      16 allocs/op

From the performance point of view json clearly wins over toml.

Further read suggestions

About

Compare the performance of json vs. toml as config format using golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages