[whatwg] Proposal: navigator.cores

Adam Barth w3c at adambarth.com
Sat May 3 10:49:00 PDT 2014


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

POSIX:
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.

Adam

[1]
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/B6pQClqfCp4
[2] http://wiki.whatwg.org/wiki/NavigatorCores
[3]
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-November/024251.html
[4] http://en.wikipedia.org/wiki/Grand_Central_Dispatch
[5]
https://groups.google.com/a/chromium.org/d/msg/blink-dev/B6pQClqfCp4/bfPhYPPQqwYJ
[6] http://wg.oftn.org/projects/core-estimator/demo/


More information about the whatwg mailing list