Can Web Workers utilize 100% of a multi-core CPU?

后端 未结 2 599
南旧
南旧 2021-01-31 17:36

I\'ve been trying to find out just how capable web workers are of distributing processor load. I\'ve yet to find any demos that seem to be able to get my quad core 2600k to even

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-31 18:05

    This uses 100% on my 2500K:

    var code = "while(true){}";
    var URL = window.webkitURL || window.URL;
    var bb = new Blob([code], {type : 'text/javascript'});
    
    code = URL.createObjectURL(bb);
    
    new Worker(code);
    new Worker(code);
    new Worker(code);
    new Worker(code);
    

    http://jsfiddle.net/MTJ27/81/

提交回复
热议问题