On Tue, Jul 7, 2015 at 5:44 AM, Sunil Agrawal <sunilagra...@gmail.com> wrote:
> If my entire Node.js program is the following
>
> setInterval(function() {}, Infinity)
>
> 'top' shows it consumes 15-20% CPU
>
> If I change it to
>
> setInterval(function() {}, 100000)
>
> it drops down to < 1% CPU consumption.
>
> Any insights what's going on?
>
> TIA,
> Sunil

setInterval() in node.js follows what browsers do: intervals >
2,147,483,647 milliseconds are treated as $smallest_timeout intervals
(= 1 ms in node.js.)

In other words, `setInterval(function() {}, Infinity)` is identical to
`setInterval(function() {}, 1)`.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAHQurc9XCt5KNVLeCUKpoeOV1xSgMKvv0h3M9MvmeY%3DS%3DYS2Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to