willabides / rjson Goto Github PK
View Code? Open in Web Editor NEWA fast json parser for go
License: MIT License
A fast json parser for go
License: MIT License
The following benchmark code is wrong .
https://github.com/WillAbides/rjson/blob/main/benchmarks/goccyjson.go#L24
Must fix package from encoding/json
to goccy/go-json
and update result on README.md
When I read the benchmark code of json-iterator/go
in the benchmark of BenchmarkGetRepoValues
,
I noticed that it uses the feature that can stop the decoding process in the middle.
( https://github.com/WillAbides/rjson/blob/main/benchmarks/jsoniter.go#L100-L102 )
Of course, it is correct to use the specific feature to improve performance, but this optimization is highly dependent on the input data, so for example, if the key name of full_name
is the end of the input data, benchmark results so different.
Therefore, when measuring using the best case, it is better to consider the worst case as well, or to use a benchmark that does not depend on the input data.
If archived
, full_name
, forks
are in the top of input data .
$ go test -bench BenchmarkGetRepoValues/jsoniter
goos: darwin
goarch: amd64
pkg: github.com/willabides/rjson/benchmarks
BenchmarkGetRepoValues/jsoniter-16 5982798 192 ns/op 48 B/op 4 allocs/op
PASS
ok github.com/willabides/rjson/benchmarks 1.655s
If full_name
is in the end of input data .
$ go test -bench BenchmarkGetRepoValues/jsoniter
goos: darwin
goarch: amd64
pkg: github.com/willabides/rjson/benchmarks
BenchmarkGetRepoValues/jsoniter-16 117582 9576 ns/op 1680 B/op 123 allocs/op
PASS
ok github.com/willabides/rjson/benchmarks 2.846s
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.