News for hackers. Stuff that matters.
Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by rapsey on Sunday March 29, 2020 @01:00PM (#22720542)
If you're using Go and need to optimize to get rid of allocations. Why are you using go?
Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by richieartoul on Sunday March 29, 2020 @01:41PM (#22720896)
Performance is a spectrum and Go hits a sweet spot between ease of development and "good enough" performance by default with enough escape hatches to get "competitive with C/C++" performance in critical paths when needed.

Just because you're using a GC'd language doesn't mean that you should give no thought whatsoever to the garbage your program is generating.

Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by kyrra on Sunday March 29, 2020 @01:17PM (#22720672)
It's a common optimization in Go. The benchmark tool that ships with go allows reporting of bytes allocated per call. Many webserver frameworks in Go strive for 0 allocs so as a user of the library, you know it won't cause extra garbage.

https://scene-si.org/2017/06/06/benchmarking-go-programs/

Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by mappu on Sunday March 29, 2020 @04:43PM (#22722539)
Even in C and C++ you still need to optimize to get rid of allocations.

Maybe the allocations are more obvious, because you usually have to write them out yourself (heap-allocating RAII containers excepted), but the problem is the same.

Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by shanemhansen on Sunday March 29, 2020 @07:19PM (#22723657)
Realistically if you're able to serve 10k requests/s and you want to get to 20k and you have the option of:

a) rewriting in C++

b) pooling some objects

Which one is the right call?

Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by dirtydroog on Tuesday March 31, 2020 @04:23AM (#22735795)
Both
Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by jjtheblunt on Sunday March 29, 2020 @05:44PM (#22723041)
Not all Go programs need garbage collection to run.

Garbage collected memory allocations would be the subset of allocations for which the compiler was unable, through escape analysis or otherwise, prove that an allocation's lifetime extends past (for example) its lexical scope, in which case the analog of C auto allocation would suffice.

Re:Show HN: Molecule – Streaming, zero-allocation protobuf d... by Gibbon1 on Sunday March 29, 2020 @05:52PM (#22723106)
Thing I'd like is the ability to annotate objects and have the compiler generate a warning if the annotation is violated. As tell the compiler you expect the object to pass escape analysis. And it if doesn't the compiler will give you a bitchy warning.