Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

benchmark the golang version

License

NotificationsYou must be signed in to change notification settings

json-iterator/go-benchmark

Repository files navigation

The goal is to prove jsoniter is not slow, not to prove it is the fastest, at least good enough.My motivation of inventing json iterator is the flexibility to mix high level and low level api.Performance is the by-product of schema based parsing.

  • CPU: i7-6700K @ 4.0G
  • Level 1 cache size: 4 x 32 KB 8-way set associative instruction caches
  • Level 2 cache size: 4 x 256 KB 4-way set associative caches
  • Level 3 cache size: 8 MB 16-way set associative shared cache
  • Go: 1.8beta1

small payload

https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_small_payload_test.go

jsonparserjsoniter pull-apijsoniter reflect-apiencoding/jsoneasyjson
599 ns/op515 ns/op684 ns/op2453 ns/op687 ns/op
64 B/op64 B/op256 B/op864 B/op64 B/op
2 allocs/op2 allocs/op4 allocs/op31 allocs/op2 allocs/op

pull-api is fast, and reflection-api is not slow either.encoding/json is not that slow on i7-6700K, but much slower on cpu with smaller cache.

small

medium payload

https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go

jsonparserjsoniter pull-apijsoniter reflect-apiencoding/jsoneasyjson
5238 ns/op4111 ns/op4708 ns/op24939 ns/op7361 ns/op
104 B/op104 B/op368 B/op808 B/op248 B/op
4 allocs/op4 allocs/op14 allocs/op18 allocs/op8 allocs/op

reflect-api even out-performed the hand written parser

medium

large payload

https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_large_payload_test.go

jsonparserjsoniter pull-apiencoding/json
38334 ns/op38463 ns/op290778 ns/op
0 B/op0 B/op2128 B/op
0 allocs/op0 allocs/op46 allocs/op

This is a pure counting usage. jsonparser is faster

large

large file

test file used:https://github.com/json-iterator/test-data/blob/master/large-file.json

jsonparserjsoniter pull-apiencoding/json
42698634 ns/op37760014 ns/op235354502 ns/op
67107104 B/op4248 B/op71467896 B/op
19 allocs/op5 allocs/op272477 allocs/op

The difference here is because jsonparser take []byte as input, but jsoniter can take io.Reader as input.

large-file

About

benchmark the golang version

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2026 Movatter.jp