This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Massive slowdown in search_n in parallel mode
On 23/11/2007, Johannes Singler <singler@ira.uka.de> wrote:
> Hi Chris,
>
> > I decided to try compiling my code in 'parallel mode', hoping to make
> > use of my 2 core machine. I was somewhat suprised to see my code slow
> > down about 50 times or so.
> >
> ...
> Well, it is basically calling search() with a pseudo-sequence of n equal
> elements. The Knuth-Morris-Pratt algorithm built into search() should be
> able to analyze this and to advance in large steps, about n in this
> case, leading to O(l/n) running time again.
Just to reply to this message, after a bit of off-list discussion, it
turns out my code wasn't completely threadsafe.
Chris