go-benchmark

module
v0.0.0-...-179abe5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2017 License: MIT

README

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

jsonparser jsoniter pull-api jsoniter reflect-api encoding/json easyjson
599 ns/op 515 ns/op 684 ns/op 2453 ns/op 687 ns/op
64 B/op 64 B/op 256 B/op 864 B/op 64 B/op
2 allocs/op 2 allocs/op 4 allocs/op 31 allocs/op 2 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

jsonparser jsoniter pull-api jsoniter reflect-api encoding/json easyjson
5238 ns/op 4111 ns/op 4708 ns/op 24939 ns/op 7361 ns/op
104 B/op 104 B/op 368 B/op 808 B/op 248 B/op
4 allocs/op 4 allocs/op 14 allocs/op 18 allocs/op 8 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

jsonparser jsoniter pull-api encoding/json
38334 ns/op 38463 ns/op 290778 ns/op
0 B/op 0 B/op 2128 B/op
0 allocs/op 0 allocs/op 46 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

jsonparser jsoniter pull-api encoding/json
42698634 ns/op 37760014 ns/op 235354502 ns/op
67107104 B/op 4248 B/op 71467896 B/op
19 allocs/op 5 allocs/op 272477 allocs/op

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

large-file

Directories

Path Synopsis
govendor
src/github.com/kardianos/govendor
vendor tool to copy external source code from GOPATH or remote location to the local vendor folder.
vendor tool to copy external source code from GOPATH or remote location to the local vendor folder.
src/github.com/kardianos/govendor/cliprompt
Package cliprompt uses the CLI to prompt for user feedback.
Package cliprompt uses the CLI to prompt for user feedback.
src/github.com/kardianos/govendor/context
Package context gathers the status of packages and stores it in Context.
Package context gathers the status of packages and stores it in Context.
src/github.com/kardianos/govendor/internal/gt
package gt is for GOPATH testing for vendor.
package gt is for GOPATH testing for vendor.
src/github.com/kardianos/govendor/migrate
package migrate transforms a repository from a given vendor schema to the vendor folder schema.
package migrate transforms a repository from a given vendor schema to the vendor folder schema.
src/github.com/kardianos/govendor/pkgspec
Package pkgspec defines a schema that contains the path, origin, version and other properties.
Package pkgspec defines a schema that contains the path, origin, version and other properties.
src/github.com/kardianos/govendor/prompt
Package prompt prompts user for feedback.
Package prompt prompts user for feedback.
src/github.com/kardianos/govendor/run
Package run is a front-end to govendor.
Package run is a front-end to govendor.
src/github.com/kardianos/govendor/vcs
package vcs gets version control information from the file system.
package vcs gets version control information from the file system.
src/github.com/kardianos/govendor/vendorfile
Package vendorfile is the meta-data file for vendoring.
Package vendorfile is the meta-data file for vendoring.
src
github.com/json-iterator/go-benchmark
Package go_benchmark is a generated protocol buffer package.
Package go_benchmark is a generated protocol buffer package.
github.com/json-iterator/go-benchmark/with_10_int_fields
Package Pb is a generated protocol buffer package.
Package Pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL