3 ms·
>> somehow different from everything just being synchronous and using threads > It IS different. In async code every single line of code must be async I think
by stymaar 10y ago
>> somehow different from everything just being synchronous and using threads
> It IS different. In async code every single line of code must be async
I think you misread the gp. He was not saying that Go code is not different from async code (what you understood), he said it's not different from synchronous code using threads.
- fooyc 10y agoYou are right, I misread it. I agree that there is no visible difference in the code, and that's exactly what I like. What's different, however, is how Go routines have much less overhead than OS threads.
- pcwalton 10y agoIt's not as much as you think, and goroutines also have significant overheads that OS threads don't. Most of the time, when people talk about goroutine overhead, they're referring to the small stacks, which are actually a property of GC--there are language implementations that are 1:1 that also have small stacks, such as SML/NJ.