Totally agree and that was my point. If the desire is to speed up calls to C there are many options - done explicit (like marking calls non blocking), or implicit - once a routine makes a “unknown” C native call that routine is always bound to a dedicated thread - clearly you are trading performance for other resources in this case.
I was trying to communicate that if you don’t have to worry about type mapping you have some simpler options available than a new C compiler :) > On Mar 15, 2021, at 2:29 PM, Ian Lance Taylor <i...@golang.org> wrote: > > On Mon, Mar 15, 2021 at 12:17 PM Jason E. Aten <j.e.a...@gmail.com> wrote: >> >>> On Monday, March 15, 2021 at 12:58:38 PM UTC-5 Ian Lance Taylor wrote: >>> >>> I think it is too strong to say that the scheduler is the "bottleneck" >>> in calling C code, but I believe that the operations required to tell >>> the scheduler what is happening to the goroutine are the most costly >>> parts of a call into C code. >> >> >> Thanks Ian! I looked through >> https://github.com/golang/go/tree/master/src/cmd/cgo but couldn't >> locate where the CGO communication with the scheduler happens. Could you >> point out the code? > > It is in runtime.cgocall, notably the calls to entersyscall and > exitsyscall. Also pay attention to runtime.cgocallbackg, which is > invoked when calling back from C to Go. Both functions are in > src/runtime/cgocall.go. It will help to review the long comment at > the start of that file. > > Ian > > -- > 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/CAOyqgcXgvi5DfffbSUHn0WWq4sLtYW4bn7R2hhaDSgoWyvKGeA%40mail.gmail.com. -- 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/5DCB6CAA-C957-4B22-8FC7-12594B06E9D5%40ix.netcom.com.