alt.hn

12/8/2025 at 11:49:40 AM

Golang optimizations for high‑volume services

https://packagemain.tech/p/golang-optimizations-for-highvolume

by der_gopher

12/11/2025 at 8:17:51 PM

I've been thinking about trying an alternative JSON library, but interested to hear opinions on whether jsoniter is still recommended. There are 208 open issues on the repo, and a question about whether it's still maintained[1]

Would particularly like to know if anyone has done a performance comparison with the new API coming in the stdlib[2], which feels like a better bet. That blog says:

The Marshal performance of v2 is roughly at parity with v1. Sometimes it is slightly faster, but other times it is slightly slower. The Unmarshal performance of v2 is significantly faster than v1, with benchmarks demonstrating improvements of up to 10x.

[1] https://github.com/json-iterator/go/issues/706

[2] https://go.dev/blog/jsonv2-exp

by ad_hockey

12/11/2025 at 8:11:04 PM

I'd be curious to know transactions per second (or other metrics) before and after the suggested changes.

by jftuga

12/11/2025 at 9:08:20 PM

Indeed. The post can be more interesting with proper metrics to backup the impact of each change.

by theHurzzen

12/11/2025 at 8:53:42 PM

I'm currently working on a project that is using an OpenAPI library that decided to use a non-standard JSON encoder. The developer experience definitely suffers when you can't use common encoding/json patterns in your own code. Simple operations become unnecessarily awkward

by aranw

12/12/2025 at 5:12:26 PM

Interesting tips, looking into Go perf recently also. However making sure postgres wal log does not grow seems like putting an unnecessary constraint on things and then defeating it

by foobarkey

12/11/2025 at 8:30:55 PM

My first thought: Controlling allocations and minding constraints... honestly, that's engineering stuff all services should care about. Not only "high-volume" services.

by vrnvu

12/11/2025 at 8:36:55 PM

I'm definitely in favor of not pessimizing code and assuming you can just hotspot optimize later, but I would say to avoid reusing objects and using sync.pool if it's really not necessary. Go doesn't provide any protections around this, so it does increase the chance of bugs, even if it's not too difficult to do right.

by ashf023

12/12/2025 at 2:33:09 AM

What are the options? Repeated allocations are a huge performance sink.

by Yokohiii

12/11/2025 at 9:51:45 PM

Was curious to read this, but then the massive full-page ugly-on-purpose AI-generated NFT-looking banner image at the top of the page turned my stomach to the point where there's no way I'd even consider it - even if the article isn't AI-generated (which it probably is).

by Ameo

12/11/2025 at 10:11:25 PM

Please don't complain about tangential annoyances—e.g. article or website formats, name collisions, or back-button breakage. They're too common to be interesting.

https://news.ycombinator.com/newsguidelines.html

by tptacek