You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.
This repository might've been useful 5 years ago when it was first created, but context has gotten really good first-class support in Golang, and its entirely possible to do exactly what goprocess does, except better, and more efficient.
Generally I see goprocess being used in a lot of places where goroutines are created. This makes creating a goroutine a very non-lightweight operation which is the exact opposite. Creating a goroutine should be lightweight!
That means every single goroutine we spin up creates a fuck ton of allocation. And its done twice every time Go is called!
// This is because having the process youfuncGo(fProcessFunc) Process {
// return GoChild(Background(), f)// we use two processes, one for communication, and// one for ensuring we wait on the function (unclosable from the outside).p:=newProcess(nil)
waitFor:=newProcess(nil)
p.WaitFor(waitFor) // prevent p from closinggofunc() {
f(p)
waitFor.Close() // allow p to close.p.Close() // ensure p closes.
}()
returnp
}
There's so many simpler and more idiomatic approaches like:
In some of the forks I have for libp2p, and ipfs libraries the profiling I do makes jbenet/goprocess
show up as a noticeable consumer of resources, and I encourage this to be done by libp2p developers because it's pretty clear goprocess needs to go.
The text was updated successfully, but these errors were encountered:
This repository might've been useful 5 years ago when it was first created, but
context
has gotten really good first-class support in Golang, and its entirely possible to do exactly what goprocess does, except better, and more efficient.Generally I see goprocess being used in a lot of places where goroutines are created. This makes creating a goroutine a very non-lightweight operation which is the exact opposite. Creating a goroutine should be lightweight!
Consider what happens everytime the
Go
function is called from goprocess, and this is done a lot!!! (https://github.com/jbenet/goprocess/blob/7f9d9ed286badffcf2122cfeb383ec37daf92508/impl-mutex.go#L26).That means every single goroutine we spin up creates a fuck ton of allocation. And its done twice every time
Go
is called!There's so many simpler and more idiomatic approaches like:
In some of the forks I have for libp2p, and ipfs libraries the profiling I do makes
jbenet/goprocess
show up as a noticeable consumer of resources, and I encourage this to be done by libp2p developers because it's pretty clear goprocess needs to go.
The text was updated successfully, but these errors were encountered: