Skip to content

Instantly share code, notes, and snippets.

@maritz
Created April 1, 2014 13:55
Show Gist options
  • Save maritz/9914444 to your computer and use it in GitHub Desktop.
Save maritz/9914444 to your computer and use it in GitHub Desktop.
Node.js setInterval CPU usage weirdness
var test = setInterval(function () {
var a = 1;
}, 33.3); // the only difference is not using a float here. This file uses about 21% cpu on my vps
var test = setInterval(function () {
var a = 1;
}, 33); // the only difference is not using a float here. This file uses basically 0.0% cpu on my vps
Copy link

ghost commented Apr 1, 2014

My test: 0.3%~1.4%(low_cpu.js), 2%~3.3%(high_cpu.js)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment