3 ms·
Sadly Go chose to use Garbage Collection instead of Reference Counting. I love using Python or Swift for applications that allocate (and free) real hardware re
by wben 12y ago
Sadly Go chose to use Garbage Collection instead of Reference Counting. I love using Python or Swift for applications that allocate (and free) real hardware resources, like OpenGL texture maps, frame buffer objects and in memory images.
- pjmlp 12y agoBecause they care about performance in multi-core contexts.
- danieldk 12y agoReference counting and multi-core performance are not mutually exclusive at all. In a lot of applications where you exploit parallelism, you parallelise loops (e.g. via OpenMP), usually objects go out of scope outside the parallelized loop (single threaded code), so you can use a bare pointer. In the loop you do mostly stack allocations. Of course, there are degenerate cases where there's a lot of lock contention on the reference count. However, there are degenerate cases in most garbage collectors for multi-core as well. Isn't Go still using a stop-the-world GC? Edit: I wanted to add that I am not against garbage collectors. You lose deterministic destructors, but a well-developed garbage collector like the JVM's is very performant in most situations, and in many cases indeed more performant than reference counting.