W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2009

[whatwg] [Web workers] An attribute describing the "best" number of worker to invoke in a delegation use case

From: David Bruant <bruant@enseirb-matmeca.fr>
Date: Mon, 07 Dec 2009 14:08:28 -0800
Message-ID: <4B1D7CDC.6050907@enseirb-matmeca.fr>
Ian Hickson a ?crit :
> On Wed, 11 Nov 2009, David Bruant wrote:
>   
>> This is a new proposal taking into account the feedback I recieved to 
>> the "[WebWorkers] About the delegation example" message.
>>
>> In the delegation example of the WebWorker spec, we can see this line :
>> "var num_workers = 10;"
>>
>> My concern is about the arbitrarity of the "10".
>>     
>
> I agree that it's suboptimal. However, I think realistically a good 
> implementation of parallel work would need some sort of dynamic 
> performance tuning, continuously slowly ramping up the number of workers 
> while it increases throughput, and when throughput decreases, switching to 
> reducing the number of workers until throughput increases again. That 
> would probably be too complicated to show in an example in the spec.
>   
=> As far as I know, if the running time is a decreasing function of the
number of workers (which seems to be a non-such-trivial assumption), the
best algorithm (on average, of course !) is to double the number of
workers until finding a barrier in the running time (find n such as the
max is between [2^n, 2^(n+1)[ ). Then, use a dichotomy algorithm in this
interval.

However, running this algorithm each time a UA comes in your website can
become to be costly.
I think that the spec should say something about "finding the correct
number of thread for your problem" and encourage authors to store their
value with the local storage and add a date to re-run the algorithm if
the value is old (more than two months ?)

>> My point is that this number may be available very easily. For example, 
>> in my dual-core, Linux, Firefox 3.5, the number is 2. Why spare an 
>> information that can be useful and reliable (more than measurement at 
>> least !) ?
>>     
>
> It's actually probably quite rarely 2. It depends on all kinds of factors, 
> like the kind of algorithm, what other programs are running, etc.
>
>
> I still haven't added this feature, as I do not believe the arguments 
> presented form a convincing case. However, if you are still interested in 
> persuing this feature, I encourage you to convince a browser vendor to 
> implement it, as discussed here:
>
>    http://wiki.whatwg.org/wiki/FAQ#Is_there_a_process_for_adding_new_features_to_a_specification.3F
>
> Cheers,
>   
I understand now that my proposition was not very realistic. However, I
think that something should be described in the spec to avoid arbitrary
choices of number of workers.

I'm convinced that with canvas and workers, we will see very soon fancy
web video games with AI. Authors of those games will want to use as many
computation power as possible for their AI, so the "best number of
workers" will be a value that they are interested in.

So, either an "hint" can be provided by the spec through the Navigator
object, either the spec could provide the above described method
(improve my description or ask me to improve it if you want) to find the
"best" number (according to a particular problem).

Thanks,

David
Received on Monday, 7 December 2009 14:08:28 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:54 UTC