in reply to Poor performances with threads

... calculate the standard deviation of the values of a small slice of the initial array ...

If it takes longer to spawn the thread, than to process that small slice, you have a net slowdown.

How long does a single (non-threaded) solution take? How many cores do you have? How many concurrent threads does that graph represent?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)

Replies are listed 'Best First'.
Re^2: Poor performances with threads
by olafmar (Novice) on Oct 23, 2009 at 10:20 UTC
    The graph represents 1, 2, 3, 4, 8 threads and I have 8 cores.

    Actually I haven't thought about the time required to spawn the thread... since each thread has at least 55k sets of 7 values to work on, I thought the time required to spawn the thread was negligible.

    1 thread: 60 seconds
    2 threads: 40 seconds
    4 threads: 37 seconds
    8 threads: 54 seconds

    I think I will settle on 2 threads for the time being, it should be a good compromise also for smaller datasets.