News for hackers. Stuff that matters.
Re:Preserving Order in Concurrent Go Apps: Three Approaches ... by kamranjon on Monday September 01, 2025 @11:31AM (#45093529)
Often in go I’ll create some data structure like a map to hold the new value keyed by the original index (basically a for loop with goroutines inside that close over the index value) - then I just reorder them after waiting for all of them to complete.

Is this basically what Java is doing?

I think that maybe the techniques in this article are a little more complex, allowing you to optimize further (basically continue working as soon as possible instead of just waiting for everything to complete and reordering after the fact) but I’d be curious to know if I’ve missed something.

Re:Preserving Order in Concurrent Go Apps: Three Approaches ... by gleenn on Monday September 01, 2025 @11:34AM (#45093567)
It's a reasonable solution. The problem with this solution is mentioned in the article, you necessarily have the worst case memory usage because you have to store everything in the map first. If you don't have too much to store, it will work.