Skip to content

Conversation

bridgetlane
Copy link
Contributor

Description: This PR is to address the open issue: #164

Benchmark before change:

goos: darwin
goarch: amd64
pkg: github.com/buger/jsonparser/benchmark
BenchmarkJsonParserLarge-8 200000 49082 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserMedium-8 1000000 7254 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserDeleteMedium-8 1000000 7638 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualMedium-8 1000000 5123 ns/op 112 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructMedium-8 1000000 5726 ns/op 544 B/op 12 allocs/op
BenchmarkJsonParserObjectEachStructMedium-8 1000000 7774 ns/op 496 B/op 11 allocs/op
BenchmarkJsonParserSmall-8 10000000 766 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualSmall-8 10000000 616 ns/op 80 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructSmall-8 10000000 1192 ns/op 192 B/op 8 allocs/op
BenchmarkJsonParserObjectEachStructSmall-8 10000000 784 ns/op 176 B/op 7 allocs/op
BenchmarkJsonParserSetSmall-8 10000000 1105 ns/op 768 B/op 4 allocs/op
BenchmarkJsonParserDelSmall-8 5000000 1388 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/buger/jsonparser/benchmark 101.571s

Benchmark after change:

goos: darwin
goarch: amd64
pkg: github.com/buger/jsonparser/benchmark
BenchmarkJsonParserLarge-8 200000 47197 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserMedium-8 1000000 7353 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserDeleteMedium-8 1000000 7470 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualMedium-8 1000000 5169 ns/op 112 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructMedium-8 1000000 5568 ns/op 544 B/op 12 allocs/op
BenchmarkJsonParserObjectEachStructMedium-8 1000000 7740 ns/op 496 B/op 11 allocs/op
BenchmarkJsonParserSmall-8 10000000 750 ns/op 0 B/op 0 allocs/op
BenchmarkJsonParserEachKeyManualSmall-8 20000000 621 ns/op 80 B/op 2 allocs/op
BenchmarkJsonParserEachKeyStructSmall-8 10000000 835 ns/op 192 B/op 8 allocs/op
BenchmarkJsonParserObjectEachStructSmall-8 10000000 721 ns/op 176 B/op 7 allocs/op
BenchmarkJsonParserSetSmall-8 10000000 1100 ns/op 768 B/op 4 allocs/op
BenchmarkJsonParserDelSmall-8 5000000 1565 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/buger/jsonparser/benchmark 104.016s

For running benchmarks use:

go test -test.benchmem -bench JsonParser ./benchmark/ -benchtime 5s -v
# OR
make bench (runs inside docker)

@buger buger merged commit 9a982e5 into buger:master Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants