Javascript node.js Windows 7中的CPU

Javascript node.js Windows 7中的CPU,javascript,windows,node.js,Javascript,Windows,Node.js,我在Windows7中使用node.js,有一个banch异步函数堆栈,并作为 stack = { nextStep: function() { if (this.run) return; this.run = true; /* Do some stuff, example for (var i = 0; i < 10000; i++) console.log(i); */ this.run = false; } }; setInterval(stack.nextSt

我在Windows7中使用node.js,有一个banch异步函数堆栈,并作为

stack = {
nextStep: function() {
  if (this.run) return;
  this.run = true;

  /* Do some stuff, example for (var i = 0; i < 10000; i++) console.log(i); */

  this.run = false;
}
};

setInterval(stack.nextStep.bind(stack), 5);
stack={
下一步:函数(){
如果(this.run)返回;
this.run=true;
/*做一些事情,例如(vari=0;i<10000;i++)console.log(i)*/
this.run=false;
}
};
setInterval(stack.nextStep.bind(stack),5);
我有一大堆任务,必须完成

它们运行非常慢,但CPU使用率超过2-3%!!!!我不知道为什么它的值这么低,我想,它一定是超过90%的CPU使用率。我做错了什么

我已经尝试将setInterval计时器减少到0,但它不起作用。windows任务管理器中的CPU使用率始终超过2-3%(除了某些时候,当nodejs V8获得8-9%时,但它会立即通过)


所以,问题是-我如何强制node.js使用最大CPU来更快地执行任务?或者我错了。

基本上node.js是每个进程的单线程模型。 即使您有多核机器,Node.JS也不能同时使用所有CPU。 要使用整个cpu,您需要使用节点集群。它调用多个进程,该进程将使用其他CPU

由于这个原因,vert.x(类似于node.js)比node.js更快