Created
April 1, 2014 13:55
-
-
Save maritz/9914444 to your computer and use it in GitHub Desktop.
Node.js setInterval CPU usage weirdness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
Tested on another VPS that has stronger CPU the difference is still between 0.0% (low_cpu.js) and 2-3% (high_cpu.js).