On Fri, Jun 17, 2016 at 2:23 PM, Dmitry Orlov <dmitry.or...@mixpanel.com> wrote:
> If I understand it correctly, go scheduler instruments code with additional
> yield points not related to I/O. That can help fairness too.

It will sometimes pre-empt on function calls, but this can get a bit
hairy since you can't always be sure what function calls will be
inlined. This has caused problems for me before where I was adding
lots of CPU intensive goroutines to the schedulers queue, and it was
context switching so much that it never finished any of them (which I
suppose shouldn't have suprised me, but it would be an easy mistake
for a new user who may expect CPU intensive work not to yield to
make).

For example, see this (not-very-scientific) analysis of some bcrypt
benchmarks (TL;DR they get faster if we make inlining a lot more
aggressive) which has many thousands of function calls in a loop in
the blowfish block cipher:
http://bl.ocks.org/SamWhited/ebe4f5923526c0d9220f1b5b23b56eba

—Sam


-- 
Sam Whited
pub 4096R/54083AE104EA7AD3
https://blog.samwhited.com

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to