4 ms·
It would take you 1 minute to write a Go application that exploits per-CPU data structures and probably years to debug your attempt to do so in C.
by jeffbee 2y ago
It would take you 1 minute to write a Go application that exploits per-CPU data structures and probably years to debug your attempt to do so in C.
- convolvatron 2y agoactually its really _hard_ in go to make cpu bound control flow, state, and allocation. do goroutines have any notion of locality? i've been looking and haven't been able to find anything
- jeffbee 2y agoGo comes out of the box with sync.Pool
- dilyevsky 2y agoYou can pin the go routine to a current thread using[0] and then pin the thread to a core using[1] if that’s what’s you’re after [0] - https://pkg.go.dev/runtime#LockOSThread https://pkg.go.dev/runtime#LockOSThread [1] - https://pkg.go.dev/golang.org/x/sys/unix#SchedSetaffinity https://pkg.go.dev/golang.org/x/sys/unix#SchedSetaffinity