Gojay

Languages and libraries

json library

SHOW HN2018

153points
66comments
#263of 2,155 in 2018
Top 13%of 2018 by points

How HN took it

MixedNo clear lean

3 positive, 8 neutral or asking, 1 mixed, 6 critical, out of 18 comments about the project. Thread score -0.14.

Performance: 2 for, 2 againstDesign: 0 for, 3 againstIdea: 1 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Fast throughput for high-volume JSON processing

    From 3 comments
    • You are right. I totally missed it in the first few tables. The lack of allocs for JsonParser was definitely a big win for my project. When processing at high rps (40k msg/sec),…
      nieksand on HN
    • You don't have to use structs tags (nor even structs) to use encoding/json. In fact I often don't as a lot of my usage is with maps rather than structs. I did some testing with…
      laumars on HN
    • (ffjson author here) The main feature that ffjson has that most of the non-stdlib JSON libraries is stdlib compatibility. Eg, the same struct-tags and interfaces used in stdlib…
      pquerna on HN
  • Unicode handling works well for non-Latin text

    From 2 comments
    • It's actually the next milestone, a generator for structs, maps and slices. Until now the goal was to make it ready for some high traffic services in production. These traffic…
      francoisllm on HN
    • Nope, it's quite easy to integrate unicode parsing :) just need to check for "\u1234" strings in JSON as it is valid, also need to check for utf16 surrogates. Standard package…
      francoispqr on HN

Objections

  • Requires writing struct marshal/unmarshal functions by hand, not a drop-in replacement for encoding/json

    From 3 comments
    • encoding/json's Marshal and Unmarshall uses reflect and struct tags. This library doesn't: you have to define a function to make your struct satisfy an interface.
      tptacek on HN
    • That's fine, but this library isn't a drop-in replacement for encoding/json; to be that, it has to work for people who expect tagged structs to round-trip through it, which won't…
      tptacek on HN
    • Performance is a real issue for Go's standard JSON, but this is a lot of extra boilerplate code to have to write (I'd probably codegen most of this if I had to), so I'd assume…
      tptacek on HN
  • Speed gains smaller than published benchmarks in some tests

    From 1 comment
    • You don't have to use structs tags (nor even structs) to use encoding/json. In fact I often don't as a lot of my usage is with maps rather than structs. I did some testing with…
      laumars on HN
  • Slower than Rust serde in a cross-language benchmark

    From 1 comment
    • To see how this fares against native code, I ported their benchmark to Rust's JSON library https://serde.rs/. Disclaimer: I am a maintainer of Serde. Numbers and graphs:…
      dtolnay on HN

Requests

  • A code generator for structs, maps and slices

    From 2 comments
    • The next milestone is actually to write a code generator for structs, maps and slices.
      francoisllm on HN
    • It's actually the next milestone, a generator for structs, maps and slices. Until now the goal was to make it ready for some high traffic services in production. These traffic…
      francoisllm on HN
  • Benchmarks covering real-world throughput

    From 1 comment
    • There's an important distinction between the decoding speed of documents and overall throughput. Wonder what can be done to realistically generate something approximating a real…
      Twirrim on HN

Questions

  • How does it compare to ffjson and go-codecgen?

    From 2 comments
    • I have been using ffjson[1] in a couple of private projects, which generates code to encode/decode data, which supposedly is faster than the json library from Go's standard…
      krylon on HN
    • How does this compare to http://ugorji.net/blog/go-codecgen ?
      segmondy on HN

Alternatives named

  • buger/jsonparser

    From 1 comment
    • The fastest Go JSON parser I know of is https://github.com/buger/jsonparser. I've used that one in production quite successfully. I don't see that in the comparative benchmarks…
      nieksand on HN
  • ffjson

    From 2 comments
    • I have been using ffjson[1] in a couple of private projects, which generates code to encode/decode data, which supposedly is faster than the json library from Go's standard…
      krylon on HN
    • (ffjson author here) The main feature that ffjson has that most of the non-stdlib JSON libraries is stdlib compatibility. Eg, the same struct-tags and interfaces used in stdlib…
      pquerna on HN
  • go-codec / codecgen

    From 2 comments
    • Is it? Kubernete switched from the native go Json parser to codec for performance increase. http://ugorji.net/blog/go-codecgen
      segmondy on HN
    • That's exactly what go-codec does
      segmondy on HN
  • easyjson

    From 1 comment
    • Would be handy if it included a utility to generate the (un)marshaling functions, so that can just be done as a build step. So far we’ve used https://github.com/mailru/easyjson…
      BillinghamJ on HN
  • serde (Rust)

    From 1 comment
    • To see how this fares against native code, I ported their benchmark to Rust's JSON library https://serde.rs/. Disclaimer: I am a maintainer of Serde. Numbers and graphs:…
      dtolnay on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/17112747)