[whatwg] Examples where HTML5 is not multicore-ready
ryan at ryanheise.com
Mon Jul 26 11:20:26 PDT 2010
I would like this thread to be a collection of parallel algorithms that
should run faster as the number of cores increase, but in HTML5 (using
Web Workers) will actually run slower as the number of cores increase.
If there are significant and substantial examples of parallel algorithms
that actually run slower on more expensive multi-core machines, this
would be an embarrassing result that should be addressed sooner rather
I am mostly interested in realworld examples, but some synthetic
examples could also be interesting.
Realworld example #1:
Sorting an array of large objects by a key that is contained
within the objects.
Realworld example #2:
Particle systems. To understand why this is a good example,
Particle systems are often used in games and other graphics
applications. (If anyone wants to run benchmarks, here is a
starting point: http://www.ryanheise.com/html5/particles.html)
Realworld example #3:
Guido provides an interesting example that is not game related,
and also provides a synthetic demonstration.
Realworld example #4:
Game artificial intelligence that needs to analyse large data
Synthetic example #1:
for (var i = 0; i < 100000000; i++)
array[i] = i;
Synthetic example #2
Guido's example from above.
(Although many realworld examples also follow this pattern)
For anyone who would like to contribute to these examples, here is how
to go about finding similar examples:
The kinds of examples that are likely to slow down rather than speed up
as more cores are added are those with a high memory access to cpu usage
ratio. Of these, there are two kinds:
1. Those that require heavy write access.
2. Those that mainly rely on readonly access.
Sorting and particle systems are both examples of the first kind, and
can potentially have a high memory access to cpu usage ratio.
An example of the second kind is a game artifical intelligence which
needs to analyse the entire game state without necessarily changing it.
(Beware: although the AI will not modify this memory, this is not
readonly memory. Being game "state", it will surely be updated by the
This thread is a follow-up to a recent thread:
More information about the whatwg