We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
I need Depth limit decode function with json data
but std json did not support, I want to use json.Decoder.Token to implement it
I write below benchmark to test it's performance
# go test -test.bench ".*" decode_test.go
cpu: Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
BenchmarkJsonDecode-6 331059 4878 ns/op 3984 B/op 44 allocs/op
BenchmarkGetToken-6 146536 7969 ns/op 3064 B/op 135 allocs/op
ok command-line-arguments 2.907s
the getAllToken is even slower than Decode
$ go version
go version go1.19.1 linux/amd64
The text was updated successfully, but these errors were encountered:
CC @dsnet, @bradfitz, @mvdan.
Sorry, something went wrong.
Closing as a duplicate of #40128. A huge part of it's slowness is the fact that it allocates.
On a different note, if you want to a propose a Decoder.SetDepthLimit method, that can filed separately and can be considered.
No branches or pull requests