February 1st, 2009, 06:13 AM
Windows SDK: Which Windows API functions are faster, ANSI or UNICODE?
Q: Most of Windows API functions with string parameters have both ANSI and UNICODE versions (e.g. SetWindowTextA and SetWindowTextW). Which one is faster?
A: Depends on the target Operating System.
- Windows 95/98/Me has no native support for UNICODE. To use UNICODE we have to install and use an intermediate layer (unicows.dll). See Microsoft Layer for Unicode.
So, under Windows 9x, the ANSI version is faster.
- Windows NT4.0/2000/XP/2003/Vista/Windows7 has support both for UNICODE and ANSI.
But, the lower layer (ntdll.dll) implements only the UNICODE version of functions. At the higher layers (kernel32.dll, user32.dll, etc) which we are currently used and make calls to ntdll, the ANSI version functions have to perform UNICODE-ANSI conversions.
So, under Windows NT platform, the UNICODE version is faster.
- Windows CE has support only for UNICODE. Being an embedded system it's not a good idea to add overhead using intermediate layers just to go back to old ANSI versions.
So, under Windows CE the comparison has no sense.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!