Profiling shows that kqueue.select is using most of the runtime. I suspect that it's because of all the async context switching happening in _download, which is triggering a select every time a chunk is received. This PR attempts a fix by using synchronous requests and manually yielding to the event loop.
yield_every and chunk_size may be tuned for better results.
Attempt to fix #601
Profiling shows that kqueue.select is using most of the runtime. I suspect that it's because of all the async context switching happening in
_download
, which is triggering a select every time a chunk is received. This PR attempts a fix by using synchronous requests and manually yielding to the event loop.yield_every
andchunk_size
may be tuned for better results.