Benchmark of golang’s JSON Parser

I just implemented the json-shootout benchmark in golang, using the builtin JSON parser. The code is here: https://github.com/jimbelton/json-shootout/blob/master/json-golang.go

Here are the results:

jim@noatun:~/Source/json-shootout$ go run json-golang.go
Loaded dictionary in 0.611037248s, size 126112kB
Looked up all keys in dictionary in 0.01396387

Here are the results for sxe-jitson to compare:

jim@noatun:~/Source/json-shootout$ ./sxe-jitson-bench
Loaded dictionary in 0.094674s, size 47346kB
First access in 0.007236s, size 47813kB
Looked up all keys in dictionary in 0.026487s

The go JSON parser is about as slow as python’s, and 6 times slower than sxe-jitson. It uses about 3 times the memory. On the other hand, accessing all the elements of the dictionary is about twice as fast. Go’s map implementation is blazingly fast.

About jimbelton

I'm a software developer, and a writer of both fiction and non-fiction, and I blog about movies, books, and philosophy. My interest in religious philosophy and the search for the truth inspires much of my writing.
This entry was posted in golang programming and tagged , , . Bookmark the permalink.

Leave a comment