[fpc-devel] Is calling the Windows Unicode APIs really faster than the ANSI API's?

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Sep 25 21:50:04 CEST 2008


Hi,

Yes I know we have had lengthy discussions about this before.
Everybody (whoever they might be) keeps saying that UTF-16 was chosen
for Tiburon's UnicodeString because it makes "significant speed gains"
when calling the Windows API based on UTF-16 - compared to the ANSI
API's. The whole debate goes that you wouldn't need constant
conversions between ANSI->UTF-16->ANSI.  Now it seems Free Pascal
developers want to base their design on those results as well (yes,
plus the whole compatibility thing)

Funny thing is (and I'm not alone here)...  I couldn't find a single
piece of source code from CodeGear or anybody else showing a
comparison. I couldn't find any research results (numbers) showing
that calling ANSI API's are actually slower than calling UTF-16 API's
of Windows.

Marco Cantu, as far as I can see, is the only one that shows a
comparison and numbers. Surprisingly, the ANSI calls where faster!  So
is UTF-16 really the right choice for UnicodeString? You can watch the
video and decide for yourself.
  http://blog.marcocantu.com/blog/tiburon_unicode_video_5.html

Has anybody else got sample test code that clearly shows the claimed
"significant speed gain" in using UTF-16 for Windows API's?  If so,
could you please post the code and your comparative results (timing
values).  I think most people perception was that ANSI API's will be
slower, but never really bothered to actually proof that it was.

Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list