Take the 2-minute tour ×  In my project, where I adopted Aho-
Corasick algorithm to do some message filter mode in the server
side, message the server got is string of multibyte character.
But after several tests I found the bottleneck is the conversion
between mulitbyte string and unicode wstring. What I use now is
the pair of mbstowcs_s and wcstombs_s, which takes nearly 95%
time cost of the whole mode. Also, I have tried
MultiByteToWideChar/WideCharToMultiByte, it got just the same
result. So I wonder if there is some other more efficient way to
do the job? My project is built in VS2005, and the string
converted will contain Chinese characters. Many thanks.
share|improve this question add comment  4 Answers  There are a
number of possibilities.  Firstly, what do you mean by "multi-
byte character"? Do you mean UTF8 or an ISO DBCS system?  If you
look at the definition of UTF8 and UTF16 there scope to do a
highly optimised conversion, ripping out the "x" bits and
reformatting them. See for example http://www