3 ms·
> Dislike for cgo, is similar to the old JNI displeasure, nowadays plenty of Java libraries don't have any issues making use of JNI. Issue’s cgo doesn’t just m
by masklinn 5y ago
> Dislike for cgo, is similar to the old JNI displeasure, nowadays plenty of Java libraries don't have any issues making use of JNI.
Issue’s cgo doesn’t just make the build more complex and more expensive (and yeets cross-compilation), it also makes programming way more difficult as go tooling doesn’t understand C and C tooling has no clue about Go (because non-standard calling conventions and insular tooling community and everything), and for all that cost you get little because the go/c call overhead is stupendous (still, though smaller than it used to be), and of course it locks up the scheduler (after a slice of the goroutine being blocked the go runtime will create a new one, but still…).
- pjmlp 5y agoAll of that applies equally well to JNI.
- masklinn 5y agoAbsolutely not, java uses native threading so native calls don't generally break scheduling, and java uses native threading so while native calls have some overhead it's maybe 5x for no-op functions, it's nowhere near "two orders of magnitude".