Re:How Much Memory Do You Need to Run 1M Concurrent Tasks?
by mftb on Monday May 22, 2023 @02:11AM
(#36028013)
You've misunderstood how go routines work. You need to put the "go" keyword before the function call in order for it to be run concurrently.
[ Parent
| on HN ]
Re:How Much Memory Do You Need to Run 1M Concurrent Tasks?
by cyberax on Monday May 22, 2023 @03:54AM
(#36028568)
I know perfectly well how goroutines work.
I'm NOT trying to show that Go is faster than async/await or anything similar. I'm showing that nested async/await calls are incredibly expensive compared to regular nested function calls.
Re:How Much Memory Do You Need to Run 1M Concurrent Tasks?
by foton2097 on Sunday May 28, 2023 @08:02PM
(#36109047)
You need to add to go keyword to change a normal function to a goroutine.
If you would remove async/await and Task/Return from the C# code example, it would perform pretty much the same as Go.
If you want to show that async/await calls are expensive, than you should have shown two code samples of C#, one with async/await, and one without.
Or could have done the same for Go, show one example with goroutines, and one without.
But I think everyone already know that async/await and goroutines has it's costs.
The problem is more that you are comparing Go without goroutines (without it's allocation costs) to a C# example with a poor implementation of async/await.