5 ms·
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.
by kragen 1y 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.
- Lio 1y agoI 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.
- kragen 1y agoLatency 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.
- chrisweekly 1y ago"ten thousand dollars faster"?
- kragen 1y agoYes, at the abstraction level of money, many more things become interchangeable, but in order to have something worth spending money on, we have to distinguish between those things.
- IshKebab 1y agoWhether it matters depends on what you're using it for. The point is that saying "cgo is slow" is meaningful.
- kragen 1y agoIt can be meaningful, depending on how much context there is, but statements like that often suffer a kind of context collapse where they are transplanted from contexts where they are clearly true to contexts where they are debatable or even false. Jerf gives a very clear example of this in https://news.ycombinator.com/item?id=45966261 https://news.ycombinator.com/item?id=45966261.