This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Massive slowdown in search_n in parallel mode


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.

I'm not an expert on parallel things, so I could be abusing something
stupidly, but it seems to me that search_n is just being delegated to
a non-optimised search, which has two problems.

1) It has abandoned the recent optimisation to make the code about
O(l/n) where l is the length of the string to be searched and n is the
number of occurrences when the there are few occurrences of the string
being searched for.

2) Even a trivial search_n is O(l), whereas a trivial search (as there
seems to be in search.h) is O(n*l).

Is this right, or am I badly misunderstanding what is going on?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]