>>That should be really easy to test.
>>How does your test code perform if you change it to this:
>>
>>void *TrimNString(void *arg) {
>>
  >>  string base ="fdsffdsafdsa";
  >> locale loc = locale();
  >> for(int i = 0; i != 50000000;i++)
  >> {
      >> string str = base;
      >>  trim(str, loc);
  >> }
>>    return 0;
>> }

>> Note also that trim calls the locale to look for whitespace, which is more flexible than your test for " \r\n\t".
>> That's probably a significant performance difference, too.
I have try you method, But it doesn't work.
I don't think that boost trim using the  locale cause the problem.
In the single thread envoriment, the program has the same running time as the my test. so it does't change the program complexity.