On Sat, May 3, 2014 at 10:49 AM, Adam Barth <w...@adambarth.com> wrote:

> Over on blink-dev, we've been discussing [1] adding a property to navigator
> that reports the number of cores [2].  As far as I can tell, this
> functionality exists in every other platform (including iOS and Android).
>  Some of the use cases for this feature have been discussed previously on
> this mailing list [3] and rejected in favor of a more complex system,
> perhaps similar to Grand Central Dispatch [4].  Others have raised concerns
> that exposing the number of cores could lead to increased fidelity of
> fingerprinting [5].
> My view is that the fingerprinting risks are minimal.  This information is
> already available to web sites that wish to spend a few seconds probing
> your machine [6].  Obviously, exposing this property makes that easier and
> more accurate, which is why it's useful for developers.
> IMHO, a more complex worker pool system would be valuable, but most systems
> that have such a worker pool system also report the number of hardware
> threads available.  Examples:
> C++:
> std::thread::hardware_concurrency();
> Win32:
> GetSystemInfo returns dwNumberOfProcessors
> sysctl returns HW_AVAILCPU or HW_NCPU
> Java:
> Runtime.getRuntime().availableProcessors();
> Python:
> multiprocessing.cpu_count()
> In fact, the web was the only platform I could find that didn't make the
> number of cores available to developers.

This sound like a great addition to the platform. I agree that there are no
real fingerprinting concerns and it will really benefit advanced authors
that want to optimize performance.

I wonder if this value should return the number of concurrent tasks
(including the main thread) that the system can support, as opposed to the
number of cores.
For instance, Samsung's exynos octa processor [1] has 8 cores, but only 4
should be used at a time. Desktop CPU's often support hyperthreading so
they support double the number of tasks per core [2]

2: http://ark.intel.com/products/77780

Reply via email to