Web工作人员可以使用100%的多核CPU吗? [英] Can Web Workers utilize 100% of a multi-core CPU?

查看:246
本文介绍了Web工作人员可以使用100%的多核CPU吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图找出网络工作者分配处理器负载的能力。我还没有发现任何能够让我的四核2600k甚至达到50%的演示,更不用说100%了。



下面是一个web worker演示程序,我尝试让我的CPU达到最大值:

http://nerget.com/rayjs-mt/rayjs.html



(如果你使用firebug / chrome-inspect-element进入页面的HTML并使画布变大,那么可以使它成为一个更大的图像 - 我将它设置为1920 x 1080)



即使选择了4,8,16个工人,我的CPU利用率也不能超过每核心25%左右。



有人知道你是否可以通过网络工作者使用100%的CPU?



解决方案

这对我的2500K使用100%:

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

code = URL.createObjectURL(bb);

新工人(代码);
新工人(代码);
新工人(代码);
新工人(代码);

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


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 50%, let alone 100%.

Here's a web worker demo I've tried to max my CPU on:

http://nerget.com/rayjs-mt/rayjs.html

(If you go into the page's HTML with firebug /chrome-inspect-element and make the canvas larger, you can make it raytrace a much larger image - I set mine to 1920 x 1080)

Even with 4, 8, 16 workers selected, I can't get my CPU utilization above around 25% per core.

Does anyone know if you can utilize 100% of the CPU through web workers?

(I'm using Google Chrome.)

解决方案

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/

这篇关于Web工作人员可以使用100%的多核CPU吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆