3 ms·
In addition, cgo calls are often reeely slow. I've been using the sqlite bindings to go for projects recently. sqlite doesn't allow you to write your own in-l
by gwd 7y ago
In addition, cgo calls are often reeely slow. I've been using the sqlite bindings to go for projects recently. sqlite doesn't allow you to write your own in-language functions, but instead allows you to write your own callback. I recently did some benchmarks, and the golang callback for a simple function was 20x slower than implementing it in C (1600us vs 80us), presumably due to all the marshaling and reflection required.
- masklinn 7y agoYes, you really don't want to use cgo to call small functions or helpers, the overhead is enormous.