News for hackers. Stuff that matters.
Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by nieksand on Sunday May 20, 2018 @10:58AM (#17112976)
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 for Gojay.

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by latch on Sunday May 20, 2018 @11:17AM (#17113094)
> I don't see that in the comparative benchmarks for Gojay.

Look again, JasonParser is included in some, but not all, of the benchmarks. JasonParser [apparently] allocates no memory, which, to me, seems pretty compelling.

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by nieksand on Sunday May 20, 2018 @11:57AM (#17113306)
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), GC is near the top of all my performance profiles. Driving allocs down with Buger's parser was very helpful for getting the throughput up.

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by Twirrim on Sunday May 20, 2018 @12:04PM (#17113361)
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 world benchmark to cover the throughput scenario.

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by zerr on Sunday May 20, 2018 @04:14PM (#17114541)
What's the project? Seems like a language with a GC is not a good choice, is it?
Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by nieksand on Sunday May 20, 2018 @04:30PM (#17114596)
Essentially a gloried batcher / data transformer consuming from Kafka.

Even with the GC overhead, I will still able to hit my performance goal of 40k msg/sec per AWS c3.4xl.

In a vacuum I would have picked Rust over Go for this. But Go is widely used at my work, whereas I'm the only Rust guy.

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by woolvalley on Sunday May 20, 2018 @04:58PM (#17114687)
How much of a difference you think rust would of made? Have you made something similar?
Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by nieksand on Sunday May 20, 2018 @05:22PM (#17114793)
I've written some high req/sec projects in Rust, but nothing that would be apples-to-apples to that particular Go project.

The memory access patterns are straight-forward enough that the remaining GC could definitely go away. If I had to make a wild, from the hip, and unsubstantiated guess, maybe a 2x to 5x performance multiple. That would include a comparable amount of time spent optimizing and would depend greatly on the quality of the Kafka crates for Rust (which I've never used).

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by abiox on Sunday May 20, 2018 @02:43PM (#17114171)
> JasonParser

you had me actually looking for something called JasonParser for a few moments. :P

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by conradfr on Sunday May 20, 2018 @04:25PM (#17114580)
Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by mintcrate on Sunday May 20, 2018 @05:12PM (#17114755)
That project is not an encoder/decoder - it just returns values of keys. They are not comparable as the use cases are entirely different.
Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by nieksand on Sunday May 20, 2018 @06:53PM (#17115180)
When it comes to parsing JSON, they are indeed not doing the same thing. Buger's parser is not unmarshalling into an annotated struct.

But often that struct isn't your end goal in life, such as when your data is being transformed, dispatched on, or being moved into another yet data structure. In that case unmarshalling to an intermediate structure, while convenient, is also extra computational work.

Buger's parser isn't the first thing I'd reach for, but if JSON parsing performance is an issue, ObjectEach() can be used in many places where you'd otherwise invoke json.Unmarshal.

Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by alex_dev on Sunday May 20, 2018 @08:26PM (#17115460)
Hence why the above poster said different use cases and why comparing between them is ridiculous. Using ObjectEach() for every field to reach parity with json.Unmarshal is unconscionable.
Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by tomohawk on Sunday May 20, 2018 @11:18AM (#17113096)
Re:Show HN: Gojay – Performant JSON encoder/decoder for Golang by segmondy on Sunday May 20, 2018 @05:09PM (#17114748)
Is it? Kubernete switched from the native go Json parser to codec for performance increase. http://ugorji.net/blog/go-codecgen