-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
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? Sign in to your account
I'm interested in this project, so I'd like to share some my knowledge #1
Comments
Hello, and thanks for reaching out :) You're right that this library has the same design principles as And, just like the standard library, it prioritises correctness and API usability over performance. The default behavior is a bit slower for the sake of extra sanity checks, for example, which can be disabled by the user. Over the past year we've mainly worried about the library's design and actually getting it to work, so optimizations haven't been the biggest worry. The design should still allow for good performance, but I would not expect its current version to be among the fastest json libraries today. With all that in mind, what kind of knowledge would you like to share, or how would you like to contribute? I believe we are already aware of how other fast json libraries work, at a high level, but perhaps there's some specific detail of one of them that would benefit our design or implementation. Something else you could try is measuring the performance of this library, and looking into the cases where it's significantly slower than you anticipated. That's something we will transition more towards, as we get more confident that the current design and API are decent. |
Thank you for your reply ! :) I also want the standard library to have a simple implementation. At this time, I'm not sure what features you're trying to implement as an option, (First) encoding/json always sorts when encoding a map value. Many performance-focused libraries supports to encode without sorting as the option, so you might want to consider it. As mentioned above, I was hoping to propose an improvement plan while comparing with other libraries about the problems that encoding/json has. Please let me know if there is a more suitable place. |
Hi @goccy, thanks for offering your knowledge!
A recent example is the decision to reject duplicate names by default. The presence of duplicate entries is almost always a bug and is a potential security hole. There's an obvious performance cost to this, but users can opt out by setting
We currently do not plan on sorting map keys anymore for several reasons:
Can you elaborate more on the relationship between performance and merging into an existing field? |
@dsnet Thank you for the answer !
OK, I see. Thank you.
I think this is also good. Regarding the implementation, what are your thoughts on improvement performance by caching the encoding and decoding process using the address to the type information ? |
Thank you for suggesting these, but unfortunately most of these we cannot use since they rely on We do pre-process marshal/unmarshal functionality for a given type. It's as close to your
If possible, we'd like to avoid That said, safety is a high priority for us. Any use of Also, CPU performance isn't the only priority either. Use of For some cases, we would probably provide an explicit API for reuse (e.g., some |
Thank you for your answer. I understood your plan. Thank you. |
@goccy. I recently updated the benchmarks to include correctness tests and I noticed that I'm using See https://github.com/go-json-experiment/jsonbench#correctness You can reproduce the failures by doing:
|
Hello. I'm the author of a Go's JSON library goccy/go-json.
I commented because this is a very interesting project !
I have read through the contents of the README at this time.
I'm developing the above JSON library with the goal of making it more convenient and faster while maintaining compatibility with encoding/json.
Therefore, I think that it has a similar concept to this project, and I'm very much looking forward to the future of this project.
So, I would like to share some knowledge (mainly performance aspect) when developing goccy/go-json. Is it okay to write it here?
The README mentions not to use
unsafe
, so I understand the policy differences from the library I'm developing.Including that, I would like to share my knowledge to find useful points.
Also, I know a lot of other 3rd party JSON library's implementations,
so I would like to share the approach to performance improvement in each library if you want.
The text was updated successfully, but these errors were encountered: