Skip to content
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

sched_yield rather than sleep #548

Closed
wants to merge 1 commit into from
Closed

sched_yield rather than sleep #548

wants to merge 1 commit into from

Conversation

krader1961
Copy link
Contributor

Several unit tests utilize very short duration sleeps (e.g., 100 usec)
while waiting for something to happen. The problem with this is that
on some platforms the minimum sleep interval might be 1, 10, even
100 msec. Which means the test can take one or two orders of magnitude
longer to run on those platforms compared to a platform where sleeps are
more granular. So instead of sleeping simply yield execution to another
runable thread.

This reduces the unit test run time for me from 49 minutes to 20 minutes
on OpenBSD in a virtual machine. And from 35 minutes to 16 minutes on
Cygwin.

Partial fix for #483
Partial fix for #546

Several unit tests utilize very short duration sleeps (e.g., 100 usec)
while waiting for something to happen. The problem with this is that
on some platforms the minimum sleep interval might be 1, 10, even
100 msec. Which means the test can take one or two orders of magnitude
longer to run on those platforms compared to a platform where sleeps are
more granular. So instead of sleeping simply yield execution to another
runable thread.

This reduces the unit test run time for me from 49 minutes to 20 minutes
on OpenBSD in a virtual machine. And from 35 minutes to 16 minutes on
Cygwin.

Partial fix for #483
Partial fix for #546
@krader1961
Copy link
Contributor Author

Merged since it is obviously better on some platforms and doesn't introduce any issues on the platforms that were already running the affected tests quickly. The Travis failures are the usual flakey failures having nothing to do with the PR.

@krader1961 krader1961 closed this May 23, 2018
@krader1961 krader1961 deleted the yield-dont-sleep branch May 26, 2018 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant