-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
curl: improve non-blocking STDIN performance #17566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Some more info on how I arrived at the 1ms sleep time. Using https://github.com/denandz/httpstream2tcp and 5ms delay:
2ms delay:
1ms delay:
Top output with a 1ms delay:
|
I propose an even simpler take: #17569 |
Marvelous. Tested, its even faster.
Happy to tweak this PR or close and go with #17569 - your call. |
I managed to tease out a little more performance by moving to a
|
I think doing a select is fine, but this PR now has a merge conflict after the #17572 merge |
All good, have tweaked this PR to address the merge conflict. |
Please rebase onto master and force-push |
2bb0231
to
7fa43fa
Compare
98af686
to
2bb0231
Compare
Using a select() call on supported platforms to check for data with a given timeout
2bb0231
to
f183046
Compare
Apologies, had to wrestle rebasing a bit. I think I've got this sorted now, though! :D |
Thanks! |
Fix adds an additional call to unpause curl, ensuring the progress function that pauses reading from STDIN is called frequently. Without this call, Curl will eventually only call the progress function once a second-ish which resulted in poor performance.
Additionally, the sleep time has been lowered to significantly improve performance (250MB/s versus 10MB/s). CPU usage remains low, with
top
reporting 0-1% CPU usage while waiting for input.Fixes #17553