Performance

While discussing how to let C and Go talk to one another, we saw that for each type, there is a conversion operation that needs to be executed. This can be straightforward, as it happens, for numbers, but a little bit more complex for strings, bytes, or slices, and even more when we talk about structures. These operations are not cost-free, both in terms of memory usage and performance. This will not be a problem for many applications, but if you're trying to achieve high performance, it could be your bottleneck.

The C code is not aware of what's happening in its Go counterpart. When it needs to be invoked, Go needs to pass the information about its stack to C in a format that is suitable for it. When the C code finishes its execution, the information about the stack state and the variables used needs to be transferred back from C to Go.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.214.155