for真的会独占CPU吗?

kavinbright · · 5923 次点击
buguang01
https://github.com/buguang01
因为新版本的golang解决了你说的这个问题。
#2
更多评论
jan-bar
想要拥有,必定付出。
执行`go tool compile -S test1.go > xx.txt`你会发现`for {}`实际上被优化了,根本就不是一个循环 ![image.png](https://static.golangjob.cn/230529/f67793138f3f9b0e2ce90bb0fce6c795.png)
#3
你确定不是go的调度 把阻塞的 协程放到其他cpu运行了?对for做了优化,没看懂这个 优化成啥了
#4