This should fix #420:
I also moved to time.time() for the other performance reasons cited in #420; I'm not sure if this has a meaningful impact on Windows, since I think time.time() has millisecond resolution there, not microsecond.
read in >1 byte chunks, and set a useful timeout on select()
this way, we're not rolling this loop over nearly as much, while still
preserving the overall timeout semantics
These changes made transferring a few mbytes of data over a ProxyCommand session go from an elapsed time of tens of minutes to under a minute.
Nice, would be good to get someone to test on windows too.
@jwm - Thanks for this. Can you elaborate on why using the timeout arg to select is/is not better than the sleep approach seen in the older #414 patch?
The time.time and read changes seem like they could apply regardless, though.
@lndbrg I'm not actually sure this functionality works on Windows at all, given select claims it only works on sockets, not pipes, on Windows? Forget if we've explicitly confirmed this though. (TBH I tend to be happy letting Windows support slide until an interested Windows user is available to confirm brokenness/fixes.)
As per this comment on #414 I determined yup, this approach is noticeably more efficient than the sleep approach from #414. Either one is way better than before, but we might as well go with this one since it's nearly 10x faster.
Changelog re #413, closes #454
Cherry-picked back to the 1.13 branch, then merged upwards. Thanks again!
Rad. Thanks very much, Jeff. I love having changes merged so quickly. :-)
The select() approach is probably better for throughput too - when you enter a sleep, you're committed for sleeping for that entire duration. The select() timeout lets you wake up before the timeout expires when the system receives new socket data.