I’ll go ahead and say that this is usually a Bad Idea. While the CGO interface isn’t difficult to use, it does make it much more difficult to deploy your Go program, as cross compilation becomes much more difficult. I’d suggest that you only drop into C if you really need to.
Is there even a way to do cross compilation with CGO? The last time I tried, CGO is turned off when you try to cross compile because the path to the C compiler is hard-coded in for some reason.
This is scheduled to be fixed for GO 1.3, assuming it can be made reliable enough in time.
There are ways, but it’s not pretty.
I just skimmed the article but I didn’t see where he tried to optimize or analyze the Go program to see where those 3 pesky microseconds went missing. As you mentioned, the extra overhead of builds and deployment are often not worth it… especially not for 3 microseconds.
There must be a very time-critical problem to rewrite it’s solution from Go to C.