The "asyncpreemptoff" debug option may be useful. See https://pkg.go.dev/runtime. Specifically, try running your program after doing "export GODEBUG=asyncpreemptoff=1". I'll leave it to others to explain why this can be risky; especially in a context like you described.
On Tue, Jun 28, 2022 at 6:45 PM TH <tinsk...@gmail.com> wrote: > Hey, > > I'm writing some latency & speed sensitive routines that are processing > large amount of signal data in batches. When I run this in a standalone > program the speed is fine. However when I combine this to the rest of > software (>1000 goroutines, mainly network code) the speed gets reduced by > 2x. > > Are there any low-level ways to temporary prevent preemption of a function > or a goroutine? > > Alternatively I tried to run two piece of software in parallel, via > shm+IPC synchronization methods, but futex, posix mutex, pipes, all > produced latency jitter from 20us - 200us. If there's lower latency methods > or more stable ones, please do recommend. > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/60220814-5763-4be4-a811-a9a84f64f12dn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/60220814-5763-4be4-a811-a9a84f64f12dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD97wBz36mF%3Dx5Kht3cGmx0Sz%3DoTgLxsPYUyvxpq3Z7rZQ%40mail.gmail.com.