[concurrency-interest] Problem getting any speed up in using the withIndexedMapping method in the ParallelArray class

Vitaly Davidovich vitalyd at gmail.com
Mon Jan 16 14:00:04 EST 2012

Hashing integers in a linearly-traversed array is going to be pretty quick
even on a single core (unless your hash function does something expensive);
for parallel to give you benefit, you may have to throw more work at the
problem.  How large is the int array that you're scanning?

On Mon, Jan 16, 2012 at 9:59 AM, Yuheng Long <csgzlong at iastate.edu> wrote:

> To whom it concerns,
>           I tried to parallelize a for loop these days which iterates the
> elements (Integer) of an array and applies a pure hash function on each of
> the elements
> and substitute the original elements with the results.
>           So I used the withIndexedMapping method in the ParallelArray
> class to parallelize the code.
>           I try both my 4 cores and my 24 cores machines. I did not get
> any speedup.
>           The code snippet is listed below. Would you please tell me what
> I did wrong or explain why I did not get any speedup in the implementation
> at all?
>           I would like to send out the complete code if necessary. Thank
> you.
> Hash h = new Hash();
> ForkJoinPool fjp = new ForkJoinPool();
> ParallelArray<Integer> pa = ParallelArray.createUsingHandoff(elementData,
> fjp);
> pa.replaceWithMappedIndex(h);
> public class Hash implements Ops.IntAndObjectToObject<Integer, Integer> {
>    public Integer op (int index, Integer o) {
>         int key = o;
>         /* key = the hash computation code */
>         return key;
>    }
> }
> Thank you very much,
> Sincerely,
> Yuheng
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest

617-548-7007 (mobile)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20120116/5115ef29/attachment.html>

More information about the Concurrency-interest mailing list