That was my fault too. encoding/json is slow, but not that slow.
Unfortunately the title of this thread is a bit misleading.
Apparently what is taking time here is reading the data off the wire,
rather than decoding the data once it has arrived.
So it seems that that the slowness is probably not
you could try ffjson https://github.com/pquerna/ffjson
On Tuesday, April 28, 2020 at 12:49:08 PM UTC-4, Sarath Prabath Redlapalli
Jaya wrote:
>
> req := &mystruct{}
> json.NewDecoder(r.Body).Decode(req)
>
>
> We've instrument the above code block and reading request body bytes is
> taking very l
encoding/json is quite old and not particularly fast.
There are some other implementations around which use code generation
rather than reflection, and which claim to give a speedup of 3x or meore
I would try one of them:
https://github.com/mailru/easyjson
or https://github.com/pquerna/ffjson
On