From assembler to C++: the internals and optimization of CGo ☠️
summary
Explains how Go's goroutine scheduler interacts with C/C++ via cgo, detailing the cgo bridge implementation and optimization techniques. Covers memory allocation tracking and how data is marshaled/shared between Go and C/C++ to improve performance and correctness.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 2:34What is CGO and why slow
- 7:08Calling C from Go
- 11:04FastCGO basics
- 17:10Stack switching in FastCGO
- 22:50Parameter exchange Go/C++
- 29:52Heap issues and escape analysis
- 33:27Data types and struct alignment
- 35:13Memory management and leaks
- 37:44FastCGO vs CGO
- 39:12Conclusion and GitHub code
- 39:56Q&A
related talks
46mWhat C and C++ can do and when do you need Assembly?
01h 06mModern C and What We Can Learn From It
51mHow Profile-Guided Optimization Makes Your Code Faster Without Any Code Changes
41mUnderstanding 5 languages memory models (or most of them)
57mA Tour of Polymorphism Techniques in C++
01h 16mPolymorphism, Cohesion, and Coupling in C++
01h 40mDesign Patterns: Examples in C++
01h 36m“extern c: Talking to C Programmers about C++”
