Skip to content

Update the comparing benchmark results in README #376

Closed
@jmoh932

Description

@jmoh932

There are two opened issues pointing out the benchmark results are out of date. And the issue dates are really old. Issue309 and Issue339.

And I just did the benchmark myself, I grabbed the code which README linked https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go , and modify it to avoid building error. I just did a medium payload test. So here is the result,

$ go test -bench=. -benchmem benchdiff_test.go
goos: darwin
goarch: amd64
BenchmarkDifference/std-struct-8         	   50000	     28352 ns/op	    1960 B/op	      99 allocs/op
BenchmarkDifference/jiter-struct-8       	  300000	      5615 ns/op	     480 B/op	      45 allocs/op
BenchmarkDifference/jiter-comp-struct-8  	  300000	      5556 ns/op	     480 B/op	      45 allocs/op
BenchmarkDifference/std-map-8            	   50000	     36106 ns/op	   10341 B/op	     212 allocs/op
BenchmarkDifference/jiter-map-8          	  100000	     22802 ns/op	   10983 B/op	     266 allocs/op
BenchmarkDifference/jiter-comp-map-8     	  100000	     23020 ns/op	   10983 B/op	     266 allocs/op
PASS
ok  	command-line-arguments	12.473s
$ go version
go version go1.10.7 darwin/amd64

Should we update README, or why not?

And for more additional out of scope informations, here is another result, same test, same code and same machine, with the PR367 patched,

$ go test -bench=. -benchmem benchdiff_test.go
goos: darwin
goarch: amd64
BenchmarkDifference/std-struct-8         	   50000	     27257 ns/op	    1960 B/op	      99 allocs/op
BenchmarkDifference/jiter-struct-8       	  300000	      5246 ns/op	     414 B/op	       6 allocs/op
BenchmarkDifference/jiter-comp-struct-8  	  300000	      5387 ns/op	     414 B/op	       6 allocs/op
BenchmarkDifference/std-map-8            	   50000	     35831 ns/op	   10341 B/op	     212 allocs/op
BenchmarkDifference/jiter-map-8          	  100000	     22469 ns/op	   10671 B/op	     159 allocs/op
BenchmarkDifference/jiter-comp-map-8     	  100000	     22300 ns/op	   10672 B/op	     159 allocs/op
PASS
ok  	command-line-arguments	12.106s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions