tidwall / gjson

Get JSON values quickly - JSON parser for Go
MIT License
13.95k stars 841 forks source link

Improve JSON perfomance with jsoniter #274

Closed kitsuniru closed 2 years ago

kitsuniru commented 2 years ago

Jsoniter algorithms better with marshalling and unmarshalling, so, why don't use them?

tidwall commented 2 years ago

why don't use them?

While jsoniter may be a little faster than encoding/json, I've been meaning to remove the encoding/json dependency altogether. I was only using it for encoding json strings that had unicode or needed escape characters.

I pushed an update moments ago that replace the need for the encoding/json, and adds a new function AppendJSONString which converts a string to json and appends it to a byte slice, and it’s a little faster than both "encoding/json" and "jsoniter".

https://gist.github.com/tidwall/4bba4ee9473f810371046b8564d45e9d

kitsuniru commented 2 years ago

Oops, seems like i didn't notice that commit, sorry ^_^ Glad to see dependency-free solution from you, thanks!