News for hackers. Stuff that matters.
Re:How much memory do you need in 2024 to run 1M concurrent ... by SPascareli13 on Thursday November 28, 2024 @11:47PM (#42270895)
As far as I know there is no way to do Promise like async in go, you HAVE to create a goroutine for each concurrent async task. If this is really the case then I believe the submition is valid.

But I do think that spawning a goroutine just to do a non-blocking task and get its return is kinda wasteful.

Re:How much memory do you need in 2024 to run 1M concurrent ... by n2d4 on Friday November 29, 2024 @12:43AM (#42271166)
You could in theory create your own event loop and then get the exact same behaviour as Promises in Go, but you probably shouldn't. Goroutines are the way to do this in Go, and it wouldn't be useful to benchmark code that would never be written in real life.
Re:How much memory do you need in 2024 to run 1M concurrent ... by peterhon on Friday November 29, 2024 @01:00AM (#42271249)
I guess what you can do in golang that would be very similar to the rust impl would be this (and could be helpful even in real life, if all you need is a whole lot of timers):

  func test2(count int) {
  
   timers := make([]*time.Timer,count)
   for idx, _ := range timers {
    timers[idx] = time.NewTimer(10 * time.Second)
   }
   for idx, _ := range timers {
    <-timers[idx].C
   }
  }
This yields to 263552 Maximum resident set size (kbytes) according to /usr/bin/time -v

I'm not sure if I missed it, but I don't see the benchmark specify how the memory was measured, so I assumed the time -v.