----- Original Message -----
From: "David McNab" <[email protected]>
> The devil certainly puts your mind to good service ;-)

Hehe, how did you find out?

> Perhaps instead of doubling, I could add a random number between 3n/2 and
> 5n/2, where n is the current guess.

Sounds plausible.

> In fact, the simulation reveals that the random factor makes the search
> slightly faster on average.
> (code below).

So that's what your simulation's good for! I retract any previous
criticsm...

> Now, Stefan or anyone, any thoughts on the n-threads version?

Well, just do n steps at once in the first phase. In the binary search
phase, make it a n-ary search. Don't split the range you have (the range you
know the last taken slot must be in) in half, but split it in n equal parts.
Then have thread i request the slot at the i-th boundary.

The first phase is sped up roughly by a factor of n; the second phase only
by ld (n+1) - well, that's better than nothing I'd say.

-Stefan



_______________________________________________
Devl mailing list
Devl at freenetproject.org
http://lists.freenetproject.org/mailman/listinfo/devl

Reply via email to