There is a pending PR for waitgroup support. It’s probably going to be in the next release.
Until then you can use Channel(Nil)
to sync fibers.
There is a pending PR for waitgroup support. It’s probably going to be in the next release.
Until then you can use Channel(Nil)
to sync fibers.
Depends on how frequently you’re spawning them. You’re not spawning kernel threads, and even with -Dpreview_mt
you’re never spawning threads at runtime. By the time the first line of your application code executes, your app has already spun up all the kernel threads it will ever create.
To your point, fibers aren’t free. So if you’re spinning them up in a hot loop, you might gain some performance by maintaining a fiber pool. But fibers aren’t super expensive, either. HTTP::Server
spawns a new fiber for every connection. Not necessarily every request, but definitely every TCP connection.