This looks really cool! Is there any overhead with using these bindings as opposed to using Swift and calling the APIs directly?
Not the author, but yes. Go calling C is expensive, and that's precisely how this works. Whether or not that matters for your use case is another topic.
https://www.cockroachlabs.com/blog/the-cost-and-complexity-o...
In their benchmark, calling a `func() {}` in Go vs a `void foo() {}` in C (via CGo) is almost 100x faster.
$ go test -bench . -gcflags '-l' # disable inlining for fairness
BenchmarkCGO-8 10000000 171 ns/op
BenchmarkGo-8 2000000000 1.83 ns/op
EDIT: And then you still have the extra overhead when using `C.CString` and `C.GoBytes` if you're passing those sorts of arguments to C.Is this true even if only primitives are passed and returned? If so, why? For comparison, Java is fast at that these days, if I understand correctly.
(Interesting related reading regarding Java: https://web.archive.org/web/20160304055443/http://nerds-cent... )