[whatwg] Examples where HTML5 is not multicore-ready

Ryan Heise ryan at ryanheise.com
Mon Jul 26 11:20:26 PDT 2010


Hi everyone,

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
than later.

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,
	read:

	http://software.intel.com/sites/billboard/archive/ticker-tape.php

	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:

	http://www.picnet.com.au/blogs/Guido/post/2010/02/18/Html-Web-Worker-Woes-Data-Analysis-not-an-Option.aspx

	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
	structures.

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
physics engine.)

This thread is a follow-up to a recent thread:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-July/027229.html

-- 
Ryan Heise



More information about the whatwg mailing list