Reduce cpu usage by dtfinch · Pull Request #6 · AvianFlu/node-waitpid · GitHub
Skip to content

Reduce cpu usage#6

Open
dtfinch wants to merge 1 commit into
AvianFlu:masterfrom
dtfinch:patch-1
Open

Reduce cpu usage#6
dtfinch wants to merge 1 commit into
AvianFlu:masterfrom
dtfinch:patch-1

Conversation

@dtfinch

@dtfinch dtfinch commented Mar 16, 2014

Copy link
Copy Markdown

Before, it would max out a cpu core at 100% while waiting (undesirable if what it's waiting on needs the full cpu). Adding a 1ms sleep reduced its usage to about 1-2% in my case.

Before, it would max out a cpu core at 100% while waiting (undesirable if what it's waiting on needs the full cpu). Adding a 1ms sleep reduced its usage to about 1% in my case.
@AvianFlu

Copy link
Copy Markdown
Owner

@dtfinch

dtfinch commented Mar 16, 2014

Copy link
Copy Markdown
Author

Changing WNOHANG to 0 was the first thing I tried, but it was returning prematurely (which seems to contradict the waitpid documentation), so I went with the sleep instead.

@andrasq

andrasq commented Oct 1, 2014

Copy link
Copy Markdown

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.

3 participants