4 ms·
How does the Go GC work here?
by woah 8y ago
How does the Go GC work here?
- masklinn 8y agoThe Go wasm arch/target generates and bundles a GC. That likely contributes to the significant size of the wasm output (https://matthewphillips.info/programming/wasm-golang-ce.html https://matthewphillips.info/programming/wasm-golang-ce.html)
- woah 8y agoThe "Javascript is bad and webpages are too big" crowd is going to have a tough time coming up with an opinion about this.
- bitL 8y agoAt some point GC API will be exposed by the browsers themselves.
- erik_seaberg 8y agoGC depends too much on how a language runtime chooses to store the types of objects in heaps, because in the ideal case the answer is "store nothing, that type is statically known in this language".
- ori_b 8y agoNah, it's pretty simple. Javascript is bad, web pages are too big, and this is just a continuation of the insanity. The solution is to stop trying to shoehorn everyfuckingthing into the web browser. But, who cares. The web is unfixable at this point.
- amelius 8y agoBut the big question is: is it a concurrent GC, like in native Go?
- ecnahc515 8y agoI believe it's basically just bundling the runtime, so yes, it's concurrent, however WASM doesn't provide threads I believe so it's still effectively running single threaded (ie: same as GOMAXPROC=1).
- 4ad 8y agoNo, GOMAXPROC=1 is not single threaded. GOMAXPROCS=1 uses one kernel thread for running user Go code, but it uses other kernel threads for running system (runtime) Go code, or for executing system calls. More details: https://news.ycombinator.com/item?id=12460807 https://news.ycombinator.com/item?id=12460807
- amelius 8y agoYes, but if WASM is single-threaded, then how can the GC run in a different thread?
- 4ad 8y agoI don't have a deep understanding on how the WASM Go port works, sorry. I was simply responding to the parent comment about GOMAXPROCS=1. I suspect the WASM port is single threaded and blocks in the GC, but I am not an expert on this.
- azakai 8y agoA GC is bundled in the wasm. (see the function names beginning with "gc*")