home > webfront > ECMAS > javascript >

js 获取cpu核心数 window.navigator.hardwareConcurrency

Author:[email protected] Date: Hits:

写了window navigator 然后提示这个玩意window navigator hardwareConcurrency尼玛,这是啥啊?hardwareConcurrency 百度了下尼玛,没有

写了window.navigator. 然后提示这个玩意 window.navigator.hardwareConcurrency

尼玛,这是啥啊?

hardwareConcurrency 百度了下

尼玛,没有资料

看了下w3c https://wiki.whatwg.org/wiki/Navigator_HW_Concurrency

Abstract

This specification defines an API for reading the system's total number of logical processors available to the user agent, up to an optional thread limit per origin.

然后,说是cpu 核心数


Example use cases

  • Image processing in online photo editors is highly parallelizable but often hardcoded to a specific worker count. For example, this recent blog post on image processing with worker threads in JavaScript suggests hardcoding the worker count to 4. All the author has to do to is replace the 4 with navigator.hardwareConcurrency || 4 to increase performance in computers with more cores.

  • …………………………

然后,巴拉巴拉

尼玛,感觉很鸡肋……

比如,我我红米pro mtk 10核 ,毛用!

高通的4核随便一个就秒杀了……

怪不得我不知道hardwareConcurrency 这玩意!


转载本站文章《js 获取cpu核心数 window.navigator.hardwareConcurrency》,
请注明出处:https://www.zhoulujun.cn/html/webfront/ECMAScript/js/2016_1202_7911.html