Comment by kragen

7 hours ago

But what matters here is probably whether it's slow compared to the code being invoked via cgo, which is only true for pretty fine-grained APIs.

Whether it matters depends on what you're using it for. The point is that saying "cgo is slow" is meaningful.

I mean, probably what really matters is how slow things are compared to the network latency of a HTTP request.

In web-development arguing about Go-Go vs CGo-Go times is probably inconsequential.

  • Latency and throughput are not interchangeable, and it is entirely normal to do millions of subroutine calls per HTTP request, so even if latency is your only concern, a subroutine call operation with a latency ten thousand dollars faster than the HTTP request might still be too slow.

    Latency is not interchangeable with throughput because, if your single 8-core server needs to serve 200 HTTP requests per second, you need to spend less than 40 core-milliseconds per request on average, no matter whether the HTTP clients are 1ms away or 1000ms away.