|
|
|
|
|
by lsllc
1965 days ago
|
|
There's a bit of a write-up here: 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. |
|