Closed AsterDY closed 1 month ago
No thanks. Your library look interesting and fast, but I generally avoid adding dependencies to my libraries that I can't maintain. Also gjson is super stable right now and I would rather not deal with potential issues I have no control over. Finally, I ran a quick test and it appears that your library allocates memory when accessing data, which would be a regression in gjson.
Thanks, and I understand your concern. Please allow me to explain the last point "I ran a quick test and it appears that your library allocates memory when accessing data" first: I guess you just tested sonic.Get() (which is implemented by parsing-on-demands instead of repeating searching) on your data (whose scale is kind of inconsistent with the practical ones), but sonic.Get has different target users with yours, at present. Actually, this is how I intend to integrate sonic's algorithm into gjson, and here is how I benched. If you think it is not suitable to merge it, I will put it on sonic's repo.
I see. I appreciate the additional context. Perhaps I’ll take a deeper look at your changes.
Any progress? @tidwall
I don't have the free time to deeply analyze sonic and I'm not that that interested in adding dependencies to gjson.
That said, I took a cursory look at the sonic code, and from what I can see there are many instances of unsafe
and runtime linkage using go:linkname
. Often without any comments.
These are red flags that indicates to me that sonic may pose a potential future risk to end users.
I suggest you maintain your own fork.
I don't have the free time to deeply analyze sonic and I'm not that that interested in adding dependencies to gjson.
That said, I took a cursory look at the sonic code, and from what I can see there are many instances of
unsafe
and runtime linkage usinggo:linkname
. Often without any comments.These are red flags that indicates to me that sonic may pose a potential future risk to end users.
I suggest you maintain your own fork.
Sure.
Hi @tidwall , I'm the maintainer of sonic (https://github.com/bytedance/sonic). Sonic implements a set of high-performance text processors with SIMD-based C assembly, which can greatly improve the speed of JSON-skipping and string-decoding. Here are some references to our algorithm:
Meanwhile, gjson provides a set of proprietary APIs that are popular among Golang developers, thus it is hard to migrate their dependencies from gjson to sonic. If these two are combined, it will benefit a vast number of Golang users. Are you willing to depend on sonic to boost gjson's performance? If so, I will submit a pull request to gjson. Here are the estimated benefits after introducing sonic: