Go vs CPP
| Go | CPP | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Memory Management |
Go has Automatic Garbage Collection, which means memory allocation and deallocation are handled by the runtime - goroutines are garbage collected. |
CPP programmer has to do memory management using new, delete. | |||||||||||||||
| Structural Differences |
No hidden function as compared to c++
|
CPP have hidden functions, which can add overhead
|
|||||||||||||||
| RunTime overhead | Less | More due to Exception handling, virtual function calls, and dynamic dispatch | |||||||||||||||
| Goroutine vs OS Threads |
Goroutines
are faster wrt OS threads as implemented as
Green threads
by go runtime
|
slower |